Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int fact(int num)
- {
- int result=1;
- while(num)
- {
- result*=num;
- num--;
- }
- return result;
- }
- int n;
- int main()
- {
- cin>>n;
- cout<<fact(n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement