Computer Science, asked by mamtachhetri399, 5 hours ago

2) WAP to accept the purchase amount form the customer and display

the amount to be paid after the discount.

[Hint: To calculate 5% from purchase amount, d=5.0f/100.0f * pa;]​

Answers

Answered by BaapJi001
0

Question:-

WAP to accept the purchase amount form the customer and display

WAP to accept the purchase amount form the customer and displaythe amount to be paid after the discount.

WAP to accept the purchase amount form the customer and displaythe amount to be paid after the discount.[Hint: To calculate 5% from purchase amount, d=5.0f/100.0f * pa;]

Answer:

The above does not work because you are performing an integer division expression (120 / 100) which result is integer 1, and then multiplying that result to 50, giving the final result of 50.

The above does not work because you are performing an integer division expression (120 / 100) which result is integer 1, and then multiplying that result to 50, giving the final result of 50.If you want to calculate 50% of 120, use:

The above does not work because you are performing an integer division expression (120 / 100) which result is integer 1, and then multiplying that result to 50, giving the final result of 50.If you want to calculate 50% of 120, use:int k = (int)(120*(50.0f/100.0f));

Similar questions