Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. long long n, silnia, z;
  8. x: cout<<"Podaj liczbe "; cin>>n;
  9.  
  10. if(n<12 || n>1000000)
  11. {
  12. cout<<"Niepoprawna liczba, sprobuj ponownie."<<endl;
  13.  
  14. goto x;
  15. }
  16. else if(n>=12 || n<=14)
  17. {
  18. if(n>14)
  19. {
  20. cout<<"Trzy ostatnie cyfry silni z podanej liczby wynosza: 000 "<<endl;
  21. }
  22. {
  23. {
  24. silnia = 1;
  25. for (int i=1; i<=n; i++)
  26. {
  27. silnia *= i;
  28. }
  29. z=silnia%1000;
  30. }
  31.  
  32. }
  33. cout<<"Trzy ostatnie cyfry silni z podanej liczby wynosza: "<<z<<endl;
  34.  
  35. }
  36.  
  37.  
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement