void print_number(int n) { if(n<=100) { printf("%d\n",n); print_number(n+1);} } main() { int n=1; print_number(n);}
this code is using recursion only.....not loops, goto and switch.... if anyone can do it without recursion then please post ur algo... On Wed, Sep 22, 2010 at 9:19 PM, Divesh Dixit < dixit.coolfrog.div...@gmail.com> wrote: > Write an algorithm that will print 1 to n, one per each line on the > standard output, where n is > a integer parameter to the algorithm. An algorithm should not use > while, for, do-while > loops, goto statement, recursion, and switch statement. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- .... :-) ***************************************** Nishant Agarwal Computer Science and Engineering NIT Allahabad ***************************************** -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@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.