Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- using namespace std;
- int main()
- {
- string x , m;
- int s , result=1 , n;
- cout<<"Enter the number : ";
- cin>>x;
- s=x.size();
- if(x[0]>x[s-1])
- {
- m=x[s-1];
- stringstream a(m);
- a>>n;
- }
- else if(x[0]<x[s-1])
- {
- m=x[0];
- stringstream a(m);
- a>>n;
- }
- while(n>0)
- {
- result=result*n;
- n=n-1;
- }
- cout<<result;
- }
Advertisement
Add Comment
Please, Sign In to add comment