spoj BCFACT


SUBMITTED BY: Guest

DATE: Feb. 16, 2014, 9:02 a.m.

FORMAT: C++

SIZE: 483 Bytes

HITS: 927

  1. //Haha TTpro
  2. //BCFACT
  3. //http://www.spoj.com/PTIT/problems/BCFACT/
  4. #include <iostream>
  5. using namespace std;
  6. long long int giaithua(int a);
  7. int main()
  8. {
  9. int a;
  10. long long int s;
  11. while (true)
  12. {
  13. cin >>a;
  14. s= giaithua(a);
  15. cout<<s<<endl;
  16. }
  17. }
  18. long long int giaithua(int a)
  19. {
  20. long long int s=1;
  21. int i;
  22. for (i=1;i<=a;i++)
  23. {
  24. s=s*i;
  25. }
  26. return s;
  27. }

comments powered by Disqus