#WSQ09

#include <iostream>

using namespace std;
int factorial(int n1){
int r=1;
for (int c=n1; c>0; c–){
r=r*c;
}
return (r);
}

int main(){
int n;
char ans;
do{
cout << “Give me a non negative integer to give you its factorial: ” << endl;
cin >> n ;
cout << “The factorial of that number is : ” << factorial(n) << endl;
cout << “Do you want to know the factorial of another number? y/n ” << endl;
cin >> ans;
}while(ans==’y’);

cout << “Ok, have a nice day.” << endl;

return 0;

}

CC BY-SA 4.0 #WSQ09 by codemaster2016 is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.