66 999
Assignments Done
99,2%
Successfully Done
In November 2018

Answer to Question #27668 in C# for dafa

Question #27668
By using switch..case statement, construct a console program using C language to display the book price that entered by the customer and then display the new book price after the discounts. The customer needs to enter the code and the discount will be given to the customer based on the code entered by them.
Code 1 : 10% discount
Code 2 : 15% discount
Code 3 : 17% discount
Others : 5% discount
Expert's answer
//main function
int main()
{
int code=0;//code
printf("Enter code: ");//enter code
scanf("%d",&code);
switch(code){//switch
//show result
case 1:
printf("10% discount");
break;
case 2:
printf("15% discount");
break;
case 3:
printf("17% discount");
break;
default:
printf("5% discount");
break;
}
scanf("%d",&code);//dealy
return 0;
}


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions