Advertisement
Nayeemzaman

Untitled

Aug 11th, 2020
1,443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. ll fact[15];
  5. void factorial(){
  6.     fact[0]=1;
  7.     for(int i=1;i<=13;i++){
  8.         fact[i]=fact[i-1]*i;
  9.     }
  10. }
  11. int main()
  12. {
  13.     factorial();
  14.     int n;
  15.     while(cin>>n){
  16.         if(n<8)
  17.             cout<<"Underflow!"<<endl;
  18.         else if(n>13)
  19.             cout<<"Overflow!"<<endl;
  20.         else
  21.             cout<<fact[n]<<endl;
  22.     }
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement