Advertisement
mydiaz

Zero to N

Apr 11th, 2022
707
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.28 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. void zero_to_n(int);
  4. main(){
  5.     int n;
  6.     printf("Masukkan N : ");
  7.     scanf("%d", &n);
  8.     zero_to_n(n);
  9. }
  10. void zero_to_n(int n) {
  11.     static int i=0;
  12.     if (n<0)
  13.         exit(0);
  14.     printf("%d\n",i++);
  15.     zero_to_n(n-1);
  16. }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement