Q15
Q15
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int factorial(int);
void oddeven(int);
int reverse(int);
int main()
int n,op,res;
char ch;
do
printf("****Menu****\n");
printf("4. Exit\n");
switch(op)
case 1:
scanf("%d",&n);
factorial(n);
break;
case 2:
scanf("%d",&n);
oddeven(n);
break;
case 3:
scanf("%d",&n);
reverse(n);
break;
case 4:
exit(0);
break;
default:
printf("Invalid Choice...\n");
ch=getchar();
scanf("%c",&ch);
}
return 0;
int factorial(int n)
int fact=1,i;
for(i=1;i<=n;i++)
fact=fact*i;
void oddeven(int n)
if (n%2!=0)
else
int reverse(int n)
int rev=0,d;
while(n!=0)
d=n%10;
rev=rev*10+d;
n=n/10;
}
*****INPUT*****
****Menu****
1. To check the factorial
2. To check the number is odd/even
3. To reverse a number
4. Exit
Enter the choice u wanna choose: 1
Enter the number to find its factorial: 3
*****OUTPUT****
The factorial is 6
*****INPUT*****
****Menu****
1. To check the factorial
2. To check the number is odd/even
3. To reverse a number
4. Exit
Enter the choice u wanna choose: 3
Enter the number to find its reverse: 4891
*****OUTPUT****
The reverse is 1984