Q1 Write a menu driven program which has following options: 1. Factorial of a number 2. Prime or not 3. Odd or even 4. Exit Once a menu item is selected the appropriate action should be taken and once this action is finished, the menu should reappear. Unless the user selects the ‘Exit’ option the program should continue to run.

Program: 120

Write a menu driven c program which has following options:

  1. Factorial of a number
  2. Prime or not
  3. Odd or even
  4. Exit

Once a menu item is selected the appropriate action should be taken and once this action is finished, the menu should reappear. Unless the user selects the ‘Exit’ option the program should continue to run.

Output:

1. Factorial of a number
2. Prime or not
3. Odd or even
4. Exit

Enter your choice:1
Enter an integer: 5

Factorial of 5 is 120.


1. Factorial of a number
2. Prime or not
3. Odd or even
4. Exit

Enter your choice:2
Enter an integer: 5

5 is Prime Number.


1. Factorial of a number
2. Prime or not
3. Odd or even
4. Exit

Enter your choice:3
Enter an integer: 5

5 is Odd Number.


1. Factorial of a number
2. Prime or not
3. Odd or even
4. Exit

Enter your choice:4

Exit

Lokesh Kumar

Being EASTER SCIENCE's founder, Lokesh Kumar wants to share his knowledge and ideas. His motive is "We assist you to choose the best", He believes in different thinking.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.