Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- long long int fac[30];
- void fact()
- {
- fac[0]=1;
- for(int i=1;i<=20;i++)
- fac[i]=fac[i-1]*i;
- }
- int main()
- {
- fact();
- long long int n,i,j;
- while(cin>>n)
- {
- if((n>=0 && n<8) || (n<0 && n%2==0))
- cout<<"Underflow!"<<endl;
- else if(n>13 || (n<0 && n%2==-1))
- cout<<"Overflow!"<<endl;
- else
- cout<<fac[n]<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement