write printf statemen 100 times..... lolzzz On Tue, Mar 1, 2011 at 2:01 PM, Subhransu <subhransu.panigr...@gmail.com>wrote:
> Hey Guys, > @preetikatyagi : The question is pretty straight "Write a program > printing number 1 to 100 without using any loop, GOTO statement , do while > & recursion " > > @sunny : We have to come up with one one logic not each time we have to > change how we can add number's to make 100. > It has to be with caller to decide how many number he has to print & the > definition will take care of algorithm. > > > *Subhransu Panigrahi > * > *Mobile:* *+91-9840931538* > *Email:* subhransu.panigr...@gmail.com > > > > On Tue, Mar 1, 2011 at 1:27 PM, sunny agrawal <sunny816.i...@gmail.com>wrote: > >> int i=1; >> #define PRINT1 cout<<i++<<endl; >> #define PRINT2 PRINT1 PRINT1 >> #define PRINT4 PRINT2 PRINT2 >> #define PRINT8 PRINT4 PRINT4 >> #define PRINT16 PRINT8 PRINT8 >> #define PRINT32 PRINT16 PRINT16 >> #define PRINT64 PRINT32 PRINT32 >> >> int main() >> { >> //as 100 = (1100100); we need to use PRINT64, PRINT32, and PRINT4 >> PRINT64; >> PRINT32; >> PRINT4; >> } >> >> >> This will print 1 to 100. You can use this code to print from 1 to x >> (x<=128). You can extend it to larger numbers, by adding PRINT128, >> PRINT256...etc. >> >> On 3/1/11, preetika tyagi <preetikaty...@gmail.com> wrote: >> > May be we can use *goto *statement? >> > >> > On Mon, Feb 28, 2011 at 10:36 PM, gaurav gupta >> > <1989.gau...@googlemail.com>wrote: >> > >> >> Questions is : You have to print 1 to n without using any loop( for, >> >> while, >> >> do-while, goto ) and recursion. >> >> >> >> Any suggestion? >> >> >> >> >> >> On Tue, Mar 1, 2011 at 10:52 AM, preetika tyagi >> >> <preetikaty...@gmail.com>wrote: >> >> >> >>> Can you elaborate on it and provide more details? >> >>> >> >>> >> >>> On Mon, Feb 28, 2011 at 10:14 PM, Subhransupanigrahi < >> >>> subhransu.panigr...@gmail.com> wrote: >> >>> >> >>>> Is there any way to print 1 to 10 (taking an example, it can also >> extend >> >>>> to 100) without using loop, recursion. >> >>>> >> >>>> >> >>>> Sent from my iPhone >> >>>> >> >>>> -- >> >>>> 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. >> >>> >> >> >> >> >> >> >> >> -- >> >> Thanks & Regards, >> >> Gaurav Gupta >> >> 7676-999-350 >> >> >> >> "Quality is never an accident. It is always result of intelligent >> effort" >> >> - >> >> John Ruskin >> >> >> >> >> > >> > -- >> > 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. >> > >> > >> >> >> -- >> Sunny Aggrawal >> B-Tech IV year,CSI >> Indian Institute Of Technology,Roorkee >> >> -- >> 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.