Please put Try Another[Y/N]:
here in this code.
#include <iostream>
using namespace std;
int main(){
int i;
cout<<"Input i: ";
cin>>i;
cout<<"Process = ";
int fact = 1;
int n = 1;
for(int x=i; x>=1; x--){
fact *= x;
cout<<n <<"*";
n++;
}
cout<<"\nOutput: "<<fact<<endl;
}
#include<iostream>
using namespace std;
int main()
{
	int i;
	char choice;
	do
	{
		cout<<"Input i: ";
		cin>>i;
		cout<<"Process = ";
		int fact = 1;
		int n = 1;
		for(int x=i;x>=1;x--)
		{
			fact*=x;
			cout<<n<<"*";
			n++;
		}
		cout<<"\nOutput: "<<fact;
		do
		{
			cout<<"\nTry Another[Y/N]:";
	    	cin>>choice;
		}while(choice!='N'&&choice!='Y'&&choice!='n'&&choice!='y');
	}while(choice!='N'&&choice!='n');
}
Comments