Advertisement
Saleh127

UVA 10323

Aug 11th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. ios_base::sync_with_stdio(0);
  6. cin.tie(0);cout.tie(0);
  7. long long int i,n;
  8. while(cin>>n)
  9. {
  10.  
  11. if(n>=0)
  12. {
  13. if(n<8) cout<<"Underflow!"<<endl;
  14. else if(n>13) cout<<"Overflow!"<<endl;
  15. else
  16. {
  17. unsigned long long f=1;
  18. for(i=1;i<=n;i++)
  19. {
  20. f*=i;
  21. }
  22. cout<<f<<endl;
  23. }
  24. }
  25. else
  26. {
  27. n*=-1;
  28. if(n%2==0)
  29. {
  30. cout<<"Underflow!"<<endl;
  31. }
  32. else cout<<"Overflow!"<<endl;
  33. }
  34.  
  35. }
  36.  
  37.  
  38.  
  39. return 0;
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement