@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 <jpchaa...@gmail.com> 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 <dave_and_da...@juno.com> 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 <contacttoadity...@gmail.com> 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 <anika.jai...@gmail.com> > > 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.