Rather than iostream, include stdio.h, because we can't call main() from main() in c++, but we can do that in C.
Best Regards, Sachin Midha On Mar 1, 10:49 pm, Himanshu Sachdeva <himansh.sachd...@gmail.com> wrote: > #include<iostream> > int i=1; > int main() > { > printf("%d\n",i++); > return i==101?0:main(); > > } > > On 3/1/11, Logic King <crazy.logic.k...@gmail.com> wrote: > > > > > > > > > > > yes......the solution given by sunny is awesome...well done !! > > > On Tue, Mar 1, 2011 at 6:25 PM, priya mehta <priya.mehta...@gmail.com>wrote: > > >> @sunny This is awesome > > >> On Tue, Mar 1, 2011 at 6:25 PM, priya mehta > >> <priya.mehta...@gmail.com>wrote: > > >>> This is awesome !!!! > > >>> 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. > > > -- > > 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. > > -- > Himanshu Sachdeva -- 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.