Re: [algogeeks] Re: sbtration

2011-07-12 Thread Anika Jain
awesum :) thanx all

On Tue, Jul 12, 2011 at 8:27 PM, bittu  wrote:

> Lets Try For Decimal Integer Number how we add them
>
> 1 Add 759 + 674, but “forget” to carry I then get 323
> 2 Add 759 + 674 but only do the carrying, rather than the addition of
> each digit I then
>  get 1110
> 3 Add the result of the first two operations (recursively, using the
> same process de-
> scribed in step 1 and 2): 1110 + 323 = 1433
>
> we have done for decimal numbers
>
> Now, how would we do this in binary?
>
> 1 If I add two binary numbers together but forget to carry, bit[i]
> will be 0 if bit[i] in a and
> b are both 0 or both 1 This is an XOR
> 2 If I add two numbers together but only carry, I will have a 1 in
> bit[i] if bit[i-1] in a and b
> are both 1’s This is an AND, shifted
>
> 3 Now, recurse until there’s nothing to carry
>
> int add_no_arithm(int a, int b)
> {
> if (b == 0) return a;
> int sum = a ^ b; // add without carrying
> int carry = (a & b) << 1; // carry, but don’t add return
> add_no_arithm(sum, carry); // recurse
> }
>
> Subtraction uses add function internally as well as we have adder !!!
>
> int sub(int x, int y)
> {
>   return(add(x,add(~y,1));
>
> }
>
> Thanks
> Shashank Mani
> Computer Science
> Birla Institute of Technology Mesra
>
> --
> 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.



[algogeeks] Re: sbtration

2011-07-12 Thread bittu
Lets Try For Decimal Integer Number how we add them

1 Add 759 + 674, but “forget” to carry I then get 323
2 Add 759 + 674 but only do the carrying, rather than the addition of
each digit I then
  get 1110
3 Add the result of the first two operations (recursively, using the
same process de-
scribed in step 1 and 2): 1110 + 323 = 1433

we have done for decimal numbers

Now, how would we do this in binary?

1 If I add two binary numbers together but forget to carry, bit[i]
will be 0 if bit[i] in a and
b are both 0 or both 1 This is an XOR
2 If I add two numbers together but only carry, I will have a 1 in
bit[i] if bit[i-1] in a and b
are both 1’s This is an AND, shifted

3 Now, recurse until there’s nothing to carry

int add_no_arithm(int a, int b)
{
if (b == 0) return a;
int sum = a ^ b; // add without carrying
int carry = (a & b) << 1; // carry, but don’t add return
add_no_arithm(sum, carry); // recurse
}

Subtraction uses add function internally as well as we have adder !!!

int sub(int x, int y)
{
   return(add(x,add(~y,1));

}

Thanks
Shashank Mani
Computer Science
Birla Institute of Technology Mesra

-- 
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.



Re: [algogeeks] Re: sbtration

2011-07-12 Thread chandy jose paul
correction:
if(a/b<=1){
return a%b;
}
else
(a/b)*b + a%b;

assumption that difference is positive everytime

On Tue, Jul 12, 2011 at 10:29 AM, Dave  wrote:

> @Chandy: Let a = 5 and b = 3. Then x = 5 - 3 = (5/3)*3 + 5%3 = 1*3 + 2
> = 5. Check?
>
> Dave
>
> On Jul 11, 11:38 pm, chandy jose paul  wrote:
> > Y are u guys complicating things.Its as simple as this
> >
> >  x=a-b = (a/b)*b + a%b
> >
> >
> >
> > On Tue, Jul 12, 2011 at 1:18 AM, Dave  wrote:
> > > @Aditya: Since 124 is a 3-digit number, I think it would make more
> > > sense to use the 3-digit 10's complement of 46, i.e., 954. Then 124 +
> > > 954 = 1078. Since we are working in 3-digit numbers, the 1 represents
> > > an overflow, which you ignore. Thus, the answer is 78.
> >
> > > Dave
> >
> > > On Jul 11, 2:42 pm, aditya pratap  wrote:
> > > > suppose u want to do 124 - 46
> >
> > > > step1 : write 10's complement of 46 i.e. 53 (9's complement) +1 = 54
> > > > step2: add 124 + 54 = 178
> > > > step3: neglect 1 from 178 and answer will be 78.
> >
> > > > correct me if i am wrong.
> >
> > > > On Tue, Jul 12, 2011 at 12:54 AM, Anika Jain  >
> > > wrote:
> > > > > how to do subtraction of two integers widout using subtractn??
> >
> > > > > --
> > > > > 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
> > > > Aditya Pratap
> > > > MCA II
> >
> > > --
> > > 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.- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> 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.



Re: [algogeeks] Re: sbtration

2011-07-12 Thread vaibhav shukla
@hary

check sunny's solution and for '+' do with bitwise operators.

On Tue, Jul 12, 2011 at 4:11 PM, hary rathor  wrote:

> how it can done without using any arithmetic operation ?
>
> --
> 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.



Re: [algogeeks] Re: sbtration

2011-07-12 Thread hary rathor
how it can done without using any arithmetic operation ?

-- 
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.



Re: [algogeeks] Re: sbtration

2011-07-11 Thread Abhishek Sharma
@sunny: +1

On Tue, Jul 12, 2011 at 11:11 AM, Vishal Thanki wrote:

> z = x + (-y)
>
> :)
>
> On Tue, Jul 12, 2011 at 10:58 AM, Sunny T  wrote:
> > i would say.. implementing subtraction using division and modulus is more
> > costly and complicated. bit manipulation is the fastest among all
> > these techniques.
> >  x=a-b = (a/b)*b + a%b
> > .here u are performing... totally 4 operations..1 division,1
> > multiplication,1 modulus and 1 addition..
> >
> > it can be easily done by...
> >
> > x=a+(~b+1). this solution takes less number of operation than
> > ur solution and involve less costly operators.
> >
> > On Tue, Jul 12, 2011 at 10:29 AM, Dave  wrote:
> >>
> >> @Chandy: Let a = 5 and b = 3. Then x = 5 - 3 = (5/3)*3 + 5%3 = 1*3 + 2
> >> = 5. Check?
> >>
> >> Dave
> >>
> >> On Jul 11, 11:38 pm, chandy jose paul  wrote:
> >> > Y are u guys complicating things.Its as simple as this
> >> >
> >> >  x=a-b = (a/b)*b + a%b
> >> >
> >> >
> >> >
> >> > On Tue, Jul 12, 2011 at 1:18 AM, Dave 
> wrote:
> >> > > @Aditya: Since 124 is a 3-digit number, I think it would make more
> >> > > sense to use the 3-digit 10's complement of 46, i.e., 954. Then 124
> +
> >> > > 954 = 1078. Since we are working in 3-digit numbers, the 1
> represents
> >> > > an overflow, which you ignore. Thus, the answer is 78.
> >> >
> >> > > Dave
> >> >
> >> > > On Jul 11, 2:42 pm, aditya pratap 
> wrote:
> >> > > > suppose u want to do 124 - 46
> >> >
> >> > > > step1 : write 10's complement of 46 i.e. 53 (9's complement) +1 =
> 54
> >> > > > step2: add 124 + 54 = 178
> >> > > > step3: neglect 1 from 178 and answer will be 78.
> >> >
> >> > > > correct me if i am wrong.
> >> >
> >> > > > On Tue, Jul 12, 2011 at 12:54 AM, Anika Jain
> >> > > > 
> >> > > wrote:
> >> > > > > how to do subtraction of two integers widout using subtractn??
> >> >
> >> > > > > --
> >> > > > > 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
> >> > > > Aditya Pratap
> >> > > > MCA II
> >> >
> >> > > --
> >> > > 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.- Hide quoted text -
> >> >
> >> > - Show quoted text -
> >>
> >> --
> >> 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.
> >>
> >
> >
> >
> > --
> > Warm Regards,
> > Sunny T
> >
> > --
> > 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.
>
>

-- 
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.



Re: [algogeeks] Re: sbtration

2011-07-11 Thread Vishal Thanki
z = x + (-y)

:)

On Tue, Jul 12, 2011 at 10:58 AM, Sunny T  wrote:
> i would say.. implementing subtraction using division and modulus is more
> costly and complicated. bit manipulation is the fastest among all
> these techniques.
>  x=a-b = (a/b)*b + a%b
> .here u are performing... totally 4 operations..1 division,1
> multiplication,1 modulus and 1 addition..
>
> it can be easily done by...
>
> x=a+(~b+1). this solution takes less number of operation than
> ur solution and involve less costly operators.
>
> On Tue, Jul 12, 2011 at 10:29 AM, Dave  wrote:
>>
>> @Chandy: Let a = 5 and b = 3. Then x = 5 - 3 = (5/3)*3 + 5%3 = 1*3 + 2
>> = 5. Check?
>>
>> Dave
>>
>> On Jul 11, 11:38 pm, chandy jose paul  wrote:
>> > Y are u guys complicating things.Its as simple as this
>> >
>> >  x=a-b = (a/b)*b + a%b
>> >
>> >
>> >
>> > On Tue, Jul 12, 2011 at 1:18 AM, Dave  wrote:
>> > > @Aditya: Since 124 is a 3-digit number, I think it would make more
>> > > sense to use the 3-digit 10's complement of 46, i.e., 954. Then 124 +
>> > > 954 = 1078. Since we are working in 3-digit numbers, the 1 represents
>> > > an overflow, which you ignore. Thus, the answer is 78.
>> >
>> > > Dave
>> >
>> > > On Jul 11, 2:42 pm, aditya pratap  wrote:
>> > > > suppose u want to do 124 - 46
>> >
>> > > > step1 : write 10's complement of 46 i.e. 53 (9's complement) +1 = 54
>> > > > step2: add 124 + 54 = 178
>> > > > step3: neglect 1 from 178 and answer will be 78.
>> >
>> > > > correct me if i am wrong.
>> >
>> > > > On Tue, Jul 12, 2011 at 12:54 AM, Anika Jain
>> > > > 
>> > > wrote:
>> > > > > how to do subtraction of two integers widout using subtractn??
>> >
>> > > > > --
>> > > > > 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
>> > > > Aditya Pratap
>> > > > MCA II
>> >
>> > > --
>> > > 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.- Hide quoted text -
>> >
>> > - Show quoted text -
>>
>> --
>> 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.
>>
>
>
>
> --
> Warm Regards,
> Sunny T
>
> --
> 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.



Re: [algogeeks] Re: sbtration

2011-07-11 Thread Sunny T
i would say.. implementing subtraction using division and modulus is more
costly and complicated. bit manipulation is the fastest among all
these techniques.

 x=a-b = (a/b)*b + a%b

.here u are performing... totally 4 operations..1 division,1
multiplication,1 modulus and 1 addition..

it can be easily done by...

x=a+(~b+1). this solution takes less number of operation than
ur solution and involve less costly operators.

On Tue, Jul 12, 2011 at 10:29 AM, Dave  wrote:

> @Chandy: Let a = 5 and b = 3. Then x = 5 - 3 = (5/3)*3 + 5%3 = 1*3 + 2
> = 5. Check?
>
> Dave
>
> On Jul 11, 11:38 pm, chandy jose paul  wrote:
> > Y are u guys complicating things.Its as simple as this
> >
> >  x=a-b = (a/b)*b + a%b
> >
> >
> >
> > On Tue, Jul 12, 2011 at 1:18 AM, Dave  wrote:
> > > @Aditya: Since 124 is a 3-digit number, I think it would make more
> > > sense to use the 3-digit 10's complement of 46, i.e., 954. Then 124 +
> > > 954 = 1078. Since we are working in 3-digit numbers, the 1 represents
> > > an overflow, which you ignore. Thus, the answer is 78.
> >
> > > Dave
> >
> > > On Jul 11, 2:42 pm, aditya pratap  wrote:
> > > > suppose u want to do 124 - 46
> >
> > > > step1 : write 10's complement of 46 i.e. 53 (9's complement) +1 = 54
> > > > step2: add 124 + 54 = 178
> > > > step3: neglect 1 from 178 and answer will be 78.
> >
> > > > correct me if i am wrong.
> >
> > > > On Tue, Jul 12, 2011 at 12:54 AM, Anika Jain  >
> > > wrote:
> > > > > how to do subtraction of two integers widout using subtractn??
> >
> > > > > --
> > > > > 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
> > > > Aditya Pratap
> > > > MCA II
> >
> > > --
> > > 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.- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> 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.
>
>


-- 
Warm Regards,
Sunny T

-- 
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.



[algogeeks] Re: sbtration

2011-07-11 Thread Dave
@Chandy: Let a = 5 and b = 3. Then x = 5 - 3 = (5/3)*3 + 5%3 = 1*3 + 2
= 5. Check?

Dave

On Jul 11, 11:38 pm, chandy jose paul  wrote:
> Y are u guys complicating things.Its as simple as this
>
>  x=a-b = (a/b)*b + a%b
>
>
>
> On Tue, Jul 12, 2011 at 1:18 AM, Dave  wrote:
> > @Aditya: Since 124 is a 3-digit number, I think it would make more
> > sense to use the 3-digit 10's complement of 46, i.e., 954. Then 124 +
> > 954 = 1078. Since we are working in 3-digit numbers, the 1 represents
> > an overflow, which you ignore. Thus, the answer is 78.
>
> > Dave
>
> > On Jul 11, 2:42 pm, aditya pratap  wrote:
> > > suppose u want to do 124 - 46
>
> > > step1 : write 10's complement of 46 i.e. 53 (9's complement) +1 = 54
> > > step2: add 124 + 54 = 178
> > > step3: neglect 1 from 178 and answer will be 78.
>
> > > correct me if i am wrong.
>
> > > On Tue, Jul 12, 2011 at 12:54 AM, Anika Jain 
> > wrote:
> > > > how to do subtraction of two integers widout using subtractn??
>
> > > > --
> > > > 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
> > > Aditya Pratap
> > > MCA II
>
> > --
> > 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.- Hide quoted text -
>
> - Show quoted text -

-- 
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.



Re: [algogeeks] Re: sbtration

2011-07-11 Thread chandy jose paul
Y are u guys complicating things.Its as simple as this

 x=a-b = (a/b)*b + a%b

On Tue, Jul 12, 2011 at 1:18 AM, Dave  wrote:

> @Aditya: Since 124 is a 3-digit number, I think it would make more
> sense to use the 3-digit 10's complement of 46, i.e., 954. Then 124 +
> 954 = 1078. Since we are working in 3-digit numbers, the 1 represents
> an overflow, which you ignore. Thus, the answer is 78.
>
> Dave
>
> On Jul 11, 2:42 pm, aditya pratap  wrote:
> > suppose u want to do 124 - 46
> >
> > step1 : write 10's complement of 46 i.e. 53 (9's complement) +1 = 54
> > step2: add 124 + 54 = 178
> > step3: neglect 1 from 178 and answer will be 78.
> >
> > correct me if i am wrong.
> >
> > On Tue, Jul 12, 2011 at 12:54 AM, Anika Jain 
> wrote:
> > > how to do subtraction of two integers widout using subtractn??
> >
> > > --
> > > 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
> > Aditya Pratap
> > MCA II
>
> --
> 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.



[algogeeks] Re: sbtration

2011-07-11 Thread Dave
@Aditya: Since 124 is a 3-digit number, I think it would make more
sense to use the 3-digit 10's complement of 46, i.e., 954. Then 124 +
954 = 1078. Since we are working in 3-digit numbers, the 1 represents
an overflow, which you ignore. Thus, the answer is 78.

Dave

On Jul 11, 2:42 pm, aditya pratap  wrote:
> suppose u want to do 124 - 46
>
> step1 : write 10's complement of 46 i.e. 53 (9's complement) +1 = 54
> step2: add 124 + 54 = 178
> step3: neglect 1 from 178 and answer will be 78.
>
> correct me if i am wrong.
>
> On Tue, Jul 12, 2011 at 12:54 AM, Anika Jain  wrote:
> > how to do subtraction of two integers widout using subtractn??
>
> > --
> > 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
> Aditya Pratap
> MCA II

-- 
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.