int a = 20 ; //whatever value you like
int b = 30 ; // again

int sum = a - (-b) ;
cout <<sum ;

//eh ?

On Wed, Jul 13, 2011 at 6:17 PM, vaibhav shukla <vaibhav200...@gmail.com>wrote:

> :D :D ....  ;)
>
>
> On Wed, Jul 13, 2011 at 6:11 PM, Anika Jain <anika.jai...@gmail.com>wrote:
>
>> @ vaibhav: ohh sorry, ya its leaving the columns..
>> so we can do
>>
>>
>> int a=9,b=4;
>> int sum=printf("%*s%*s",a,"",b,"");
>> printf("\r%d\n",sum);
>>
>>
>> On Wed, Jul 13, 2011 at 6:09 PM, Anika Jain <anika.jai...@gmail.com>wrote:
>>
>>> @vaibhav: no it wont coz its printing empty strings.. nothing will be
>>> printed
>>>
>>>
>>> On Wed, Jul 13, 2011 at 4:42 PM, vaibhav shukla <vaibhav200...@gmail.com
>>> > wrote:
>>>
>>>> @anika : ur ans will give the sum but will also leave that much amount
>>>> of space before printing the sum
>>>>
>>>>
>>>> one betther idea is to use bitwise
>>>>
>>>>
>>>> int Mysum(int a,int b)
>>>> {
>>>>  if(b==0)
>>>>     return a;
>>>> else
>>>>  {
>>>>    int sum=a^b;
>>>>    int carry=(a&b)<<1;
>>>>    return  Mysum(sum,carry);
>>>>
>>>> }
>>>>
>>>>
>>>> On Wed, Jul 13, 2011 at 4:15 PM, dinesh bansal <bansal...@gmail.com>wrote:
>>>>
>>>>> never mind...thanks.
>>>>>
>>>>>
>>>>> On Wed, Jul 13, 2011 at 2:29 PM, dinesh bansal <bansal...@gmail.com>wrote:
>>>>>
>>>>>> Can you explain how its working?
>>>>>>
>>>>>> On Wed, Jul 13, 2011 at 1:58 PM, Anika Jain <anika.jai...@gmail.com>
>>>>>> wrote:
>>>>>>  > a better idea is use this:
>>>>>> >
>>>>>> > int a=9,b=4;
>>>>>> > int sum=printf("%*s%*s",a,"",b,"");
>>>>>> > printf("%d\n",sum);
>>>>>> >
>>>>>> >
>>>>>> > On Wed, Jul 13, 2011 at 1:52 PM, nicks <crazy.logic.k...@gmail.com>
>>>>>> wrote:
>>>>>> >>
>>>>>> >> if someone has better idea...then please suggest that.....
>>>>>> >> plz explain how this is calculating sum -->>  sum= (int)&p[b];
>>>>>> >>
>>>>>> >> On Wed, Jul 13, 2011 at 1:50 PM, nicks <crazy.logic.k...@gmail.com>
>>>>>> wrote:
>>>>>> >>>
>>>>>> >>> I am looking for a code which can add without using + sign
>>>>>> >>> i searched the net and found the following code......can anyone
>>>>>> explain
>>>>>> >>> me whats happening in this ??
>>>>>> >>>
>>>>>> >>> #include<stdio.h>
>>>>>> >>> #include<conio.h>
>>>>>> >>> int main()
>>>>>> >>> {
>>>>>> >>> int a=3000,b=20,sum;
>>>>>> >>> char *p;
>>>>>> >>> p=(char *)a;
>>>>>> >>> sum= (int)&p[b]; //adding a & b
>>>>>> >>> printf("Answer is :");
>>>>>> >>> printf("%d",sum);
>>>>>> >>> return 0;
>>>>>> >>> }
>>>>>> >>
>>>>>> >> --
>>>>>> >> You received this message because you are subscribed to the Google
>>>>>> Groups
>>>>>> >> "Algorithm Geeks" group.
>>>>>> >> To post to this group, send email to algogeeks@googlegroups.com.
>>>>>> >> To unsubscribe from this group, send email to
>>>>>> >> algogeeks+unsubscr...@googlegroups.com.
>>>>>> >> For more options, visit this group at
>>>>>> >> http://groups.google.com/group/algogeeks?hl=en.
>>>>>> >
>>>>>> > --
>>>>>> > You received this message because you are subscribed to the Google
>>>>>> Groups
>>>>>> > "Algorithm Geeks" group.
>>>>>> > To post to this group, send email to algogeeks@googlegroups.com.
>>>>>> > To unsubscribe from this group, send email to
>>>>>> > algogeeks+unsubscr...@googlegroups.com.
>>>>>> > For more options, visit this group at
>>>>>> > http://groups.google.com/group/algogeeks?hl=en.
>>>>>> >
>>>>>>
>>>>>>
>>>>>>
>>>>>>  --
>>>>>> Dinesh Bansal
>>>>>> The Law of Win says, "Let's not do it your way or my way; let's do it
>>>>>> the best way."
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Dinesh Bansal
>>>>> The Law of Win says, "Let's not do it your way or my way; let's do it
>>>>> the best way."
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Algorithm Geeks" group.
>>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> algogeeks+unsubscr...@googlegroups.com.
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>   best wishes!!
>>>> Vaibhav Shukla
>>>>     DU-MCA
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> algogeeks+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
>   best wishes!!
> Vaibhav Shukla
>     DU-MCA
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards
Anurag Atri
III year
Computer Engineering
Delhi College Of Engineering

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to