Advertisement
Guest User

Untitled

a guest
Oct 10th, 2015
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. int function (unsigned n){
  6.  
  7. if(n==1)
  8. return 5;
  9. else
  10. return function(n-1) + 2;
  11.  
  12. }
  13.  
  14. int main(){
  15.  
  16. unsigned z;
  17. scanf("%u",&z);
  18. int ar[z];
  19. printf("z = %u\n",z);
  20. for(int i=0;i<z;i++)
  21. ar[i] = function(i+1);
  22. for(int i=0;i<z;i++)
  23. printf("ar[%i] = %i\t",i,ar[i]);
  24. printf("\n");
  25.  
  26. system("pause");
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement