Advertisement
nguyenhappy92

Tính T(x,n) = xn

Sep 16th, 2015
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. // Tinh T(x,n) = x^n
  2. // khai bao thu vien
  3. #include<stdio.h>
  4. #include<conio.h>
  5.  
  6. void main()
  7. {
  8. // khai bao bien
  9. int x,n;
  10. // nhap du lieu
  11. scanf("%d%d",&x,&n);
  12. long T=1;
  13. if(n==0&&x==0)
  14. printf("Khong xac dinh");
  15. else
  16. {
  17. if(x==0)
  18. {
  19. printf("0");
  20. }
  21. else
  22. {
  23. for(int i=1;i<=n;i++)
  24. {
  25. T=T*x;
  26. }
  27. printf("%ld",T);
  28. }
  29.  
  30. }
  31.  
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement