Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-09-02 Thread annarao kataru
@sharmila u r using + operator -- 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

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-09-02 Thread siddharam suresh
if this is the case program can be rewritten to #Iincludestdio.h #includeconio.h void main() { int a,b,i; clrscr(); printf(enter 2 num:); scanf(%d%d,a,b); while(b--) a++; printf(%d,a); getch(); } Thank you, Sid. On Fri, Sep 2, 2011 at 11:30 AM, annarao kataru kataruanna...@gmail.comwrote:

[algogeeks] Re: Adding Two no without using any operator...??

2011-09-02 Thread WgpShashank
Discussed Several time , Search Threads here is one of the link https://groups.google.com/forum/#!searchin/algogeeks/add$20two$20number$20/algogeeks/laWTN1xiwx0/lYoidUsr7mIJ Thanks Shashank Mani Computer Science Birla Institute of Technology Mesra -- You received this message because you

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-09-01 Thread sharmila saru
Adding Two no without using any operator #Iincludestdio.h #includeconio.h void main() { int a,b,i; clrscr(); printf(enter 2 num:); scanf(%d%d,a,b); for(i=1;i=b-1;i++) { a=a+1; } printf(%d,a); getch(); } -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-08-29 Thread saurabh singh
@dave well that was basically a query if it is possible to eliminate all the operators and do something like addition operation.I am sorry if I presentted my question in the wrong wayI am bad at explaining things.:( Going by your previous records I am not elibigle to contradict you. On

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-08-29 Thread manish patel
Awesome Saurabh. Hats off man:) On Mon, Aug 29, 2011 at 2:43 PM, saurabh singh saurab...@gmail.com wrote: @dave well that was basically a query if it is possible to eliminate all the operators and do something like addition operation.I am sorry if I presentted my question in the wrong

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-08-29 Thread siddharam suresh
super Thank you, Sid. On Sun, Aug 28, 2011 at 7:42 AM, saurabh singh saurab...@gmail.com wrote: main() { int a=4,b=6; printf(\n%d\n,printf(%*s%*s,a,,b,)); } -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-08-29 Thread Akshat Sapra
can you please tell me how is this working main() { int a=4,b=6; printf(\n%d\n,printf(%*s%*s,a,,b,)); } -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-08-28 Thread annarao kataru
@saurubh singhhow it is working ? plz explain the logic -- 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

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-08-28 Thread saurabh singh
printf returns the number of chars it puts on the stream %*s the * is replaced by %value of as that is shifted a times and similarly for b shifted by b times.The null string ensures that nothing unwanted is printed On Sun, Aug 28, 2011 at 7:22 PM, annarao kataru kataruanna...@gmail.comwrote:

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-08-28 Thread annarao kataru
@sourabh ; thank u very much -- 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

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-08-28 Thread Shravanthi U M
if we give a=10, b=5 we get a^b=15 but wen a=10,b=7 we get a^b=13 why s it so,..??? -- 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] Re: Adding Two no without using any operator...??

2011-08-28 Thread Dave
@Shravanthi: Write a and b in binary, and then apply the bitwise exclusive-or to them and you will see why. Dave On Aug 28, 9:24 am, Shravanthi U M shravanthium...@gmail.com wrote: if we give a=10, b=5 we get a^b=15 but wen a=10,b=7 we get a^b=13 why s it so,..??? -- You received this

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-08-28 Thread Abhishek Yadav
Very nice solution sourabh. On Sun, Aug 28, 2011 at 9:52 PM, Dave dave_and_da...@juno.com wrote: @Shravanthi: Write a and b in binary, and then apply the bitwise exclusive-or to them and you will see why. Dave On Aug 28, 9:24 am, Shravanthi U M shravanthium...@gmail.com wrote: if we give

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-08-28 Thread Sanjay Rajpal
But it works only for +ve numbers. Sanju :) On Sun, Aug 28, 2011 at 9:57 AM, Abhishek Yadav algowithabhis...@gmail.comwrote: Very nice solution sourabh. On Sun, Aug 28, 2011 at 9:52 PM, Dave dave_and_da...@juno.com wrote: @Shravanthi: Write a and b in binary, and then apply the bitwise

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-08-28 Thread saurabh singh
@dave even '=' is an operator.I wonder if its possible to restrict *all operators*. On Sun, Aug 28, 2011 at 1:32 AM, Dave dave_and_da...@juno.com wrote: @Brijesh: Maybe you mean char *p; p = (char*)a; sum = (int)p[b]; // sum = a + b but is an operator. Dave On Aug 27, 2:07

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-08-28 Thread Anji
amazing solution Saurabh. Thanks! -- B Anjaneyulu Reddy http://flavors.me/anjit6 +91 7259509827 On Mon, Aug 29, 2011 at 8:02 AM, saurabh singh saurab...@gmail.com wrote: @dave even '=' is an operator.I wonder if its possible to restrict *all operators*. On Sun, Aug 28, 2011 at

[algogeeks] Re: Adding Two no without using any operator...??

2011-08-28 Thread Dave
@Saurabh: Function calls and commas are operators, so that leaves out your clever printf solution. See http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Other_operators. Dave On Aug 28, 9:32 pm, saurabh singh saurab...@gmail.com wrote: @dave even '=' is an operator.I wonder if its

[algogeeks] Re: Adding Two no without using any operator...??

2011-08-27 Thread Dave
@Mohit: Do you mean int add(int a, int b) { if (!a) return b; else return add((a b) 1, a ^ b); } Carries normally go to the left, not to the right. Dave On Aug 27, 2:28 pm, Mohit kumar lal kumarmohit...@gmail.com wrote: int add(int a, int b)

[algogeeks] Re: Adding Two no without using any operator...??

2011-08-27 Thread Dave
@Brijesh: Maybe you mean char *p; p = (char*)a; sum = (int)p[b]; // sum = a + b but is an operator. Dave On Aug 27, 2:07 pm, Brijesh brijeshupadhyay...@gmail.com wrote: How to add two nos without using any operator...? -- You received this message because you are subscribed to the Google

Re: [algogeeks] Re: Adding Two no without using any operator...??

2011-08-27 Thread saurabh singh
main() { int a=4,b=6; printf(\n%d\n,printf(%*s%*s,a,,b,)); } -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- 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