Advertisement
NS2A2

x^n đệ quy

May 14th, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.22 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int nah(int x,int n)
  5. {
  6.     if(n==0) return 1;
  7.     return x*nah(x,n-1);
  8. }
  9.  
  10. int main()
  11. {
  12.     int x,n;
  13.     scanf("%d%d",&x,&n);
  14.     printf("%d",nah(x,n));
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement