Advertisement
nguyenhappy92

Tính T(n) = 1 * 2 * 3 * ... * n

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