Advertisement
Guest User

Loops without loops

a guest
Oct 31st, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int forfunction (int count)
  4. {
  5.   if (count == 0)
  6.     return 0;
  7.   else
  8.     printf("Hello\n");
  9.     forfunction(--count);
  10. }
  11.  
  12. int main(void)
  13. {
  14.   printf("for loop:\n\n");
  15.   int i;
  16.   for (i=0;i<10;i++) {
  17.     printf("Hello\n");
  18.   }
  19.   printf("\nfor function:\n\n");
  20.   forfunction(10);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement