Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write and run a program that asks the user toenter a positive integer num , and

ID: 3612927 • Letter: W

Question

Write and run a program that asks the user toenter a positive integer num, and then choose from thefollowing menu using a switchstatement:

    1- To find factorial of num,where:

          factorial(num) = num * num-1 * num-2 *…..* 2 *1

      2- To find the sum of odd numbers from 1to num.

    If the user enters a wrongchoice, the program should display an error message.

Sample output1:

Enter a number : 7

Choose : 1: to find factorial of thenumber

              2: to find sum of odd numbers from 1 to the number

2

The sum of odd numbers from 1 to 7 is16

Press any key to continue


Sample output2:

Enter a number : 10

Choose : 1: to find factorial of thenumber

              2: to find sum of odd numbers from 1 to the number

    3

Invalid choice

Press any key to continue

Enter a number : 7

Choose : 1: to find factorial of thenumber

              2: to find sum of odd numbers from 1 to the number

2

The sum of odd numbers from 1 to 7 is16

Press any key to continue

Explanation / Answer

please rate - thanks #include using namespace std; int main() {int num,sum=0,i,nfact=1,choice; coutnum; cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote