0

```
#include<iostream.h>
main()
{
int opt,x,y,fact,ans;
for(ans=opt;ans!=0;ans++)
{
cout<<"\n\t\t\t *******MENU*******"
<<"\n\t\t\t[1] FACTORIAL OF A NUMBER"
<<"\n\t\t\t[2] PRIME NUMBER"
<<"\n\t\t\t[3] ODD OR EVEN NUMBERS"
<<"\n\t\t\t[4] MULTIPLICATION TABLE"
<<"\n\t\t\tYOUR CHOICE: ";
cin>>opt;
switch(opt)
{
case 1:
{
cout<<"\nThis program tells you the Factorial of the number you have input...";
cout<<"\nInput limit: ";
cin>>y;
fact=1;
for(x=1;x<=y;x++)
{
fact=fact*x;
}
cout<<"\nThe factorial of the number you entered is "<<fact<<"."<<endl;
break;
}
case 2:
{
cout<<"INPUT: ";
cin>>x;
for(y=2;y<=x/2;y++)
{
if(x%y==0)
{
cout<<"Not Prime.";
}
}
cout<<"Prime number.";
break;
}
case 3:
{
cout<<"\nThis program will test if the number entered is an Odd or Even number...";
cout<<"Input a number: ";
cin>>x;
if(x%2==0)
cout<<"The number you entered is Even number.";
else
cout<<"Prime numberThe number you entered is Odd number.";
break;
}
case 4:
{
for(x=1;x<=5;x++)
{
cout<<"\n";
for(y=1;y<=5;y++)
cout<<"\t"<<x*y;
}
cout<<endl;
break;
}
default:
cout<<"INVALID CHOICE!!!"<<endl;
}
cout<<"\n\t\t\tDo you wish to repeat?\n Press any number to Repeat the program Or press -1 to end..: ";
cin>>ans;
}
cout<<endl;
return 0;
}
```

*Edited 3 Years Ago by Reverend Jim*: Fixed formatting