Write a driven menu program that displays the following options: Choose one of t
ID: 3620887 • Letter: W
Question
Write a driven menu program that displays the following options:Choose one of the following options:
1.Enter he so a,b,c
2.S=a^3+b^2+c
3.Exit
Choose 1:
Print the form input a,b,c
print a,b,c
Choose 2:
Print S with a,b,c entered.
example:a=1,b=2,c=3===>S=8
Note:
If you choose 1 first it is easily but if you choose 2 first ,i think it is not easily in order to code .
I want if you choose 1 or choose 2 first,it will run correctly.
(If i give float a=0,b=0,c=0,S;) It will work correctly but i don't want give a,b,c value
Explanation / Answer
Dear user, #include void main() { int ch,a,b,c,s; printf("MENU"); printf("Choose 1:Enter a,b,c"); printf("Choose 2:s"); printf("Choose 3:Exit"); printf("Choose 1 or 2 or 3"); scanf("%d",&ch); switch(ch) { case 1: printf("Enter a,b and c values"); scanf("%d %d",&a,&b); printf("The input value a=%d",a); printf("The input value b=%d",b); break; case 2: printf("Enter a,b and c values"); scanf("%d %d",&a,&b); s=(a*a*a)+(b*b)+c; printf("s=%d",s); break; case 3: default: printf("Invalid choose"); } return 0; } IT'S HELPFUL TO YOU...Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.