Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- unsigned int n{0};
- unsigned int i{1};
- unsigned long long total{0};
- cout << "Enter a nonnegative integer: ";
- cin >> n;
- while ( i < n ){
- total = total * ( n - i );
- i++;
- }
- cout << "The factorial of this nonnegative integer is: " << total << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement