Using C programming: Write a program that prompts the user to enter integer valu
ID: 3532730 • Letter: U
Question
Using C programming: Write a program that prompts the user to enter integer values for three variables a, b, and c. The program also prompts the user to enter an integer value for the variable choice between 1 and 4. The program then computes the values of the following expressions: If the value of choice is equal to 1, the expression: 4b* c-3a If the value of choice is equal to 2, the expression: is a2 + b - 6*a*c If the value of choice is equal to 3, the expression: b* c- 2a3 / b If the value of choice is equal to 4, the expression: b* a- 3 (a+c)
Explanation / Answer
#include <stdio.h>
int main()
{
printf("Enter the values of a b and c ");
int a,b,c,ch;
scanf("%d%d%d",&a,&b,&c);
printf("Enter your choice between 1 and 4 ");
scanf("%d",&ch);
switch(c)
{
case 1:printf("Value = %d",(4*b*c-3*a)); break;
case 2:printf("Value = %d",(a*a + b - 6*a*c)); break;
case 3:printf("Value = %d",(b* c- 2*a*a*a / b)); break;
case 4:printf("Value = %d",(b*a- 3*(a+c))); break;
default: printf("Incorrect Choice ");
}
return 1;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.