Alice wants to buy a book that costs $129.95. An additional 13% HST will be adde
ID: 3797017 • Letter: A
Question
Alice wants to buy a book that costs $129.95. An additional 13% HST will be added to the cost of the book. a. Calculate the amount of HST to be added (rounded to the nearest cent) and assign this value to a variable called hst. Calculate the total amount Alice will have to pay and assign it to a variable called total. c. i) Display the amount of HST calculated with a suitable message, ii) Display the total amount to be paid with a suitable message. Over the past month, Bob put gas in his car four times, at the following rates: 20 liters at $0.93 per liter 35 liters at $0.95 per liter 30 liters at $0.92 per liter 40 liters at $0.94 per literExplanation / Answer
1. Implementation in C
#include <stdio.h>
#include <math.h>
int main()
{
float book_price=129.95,hst,total;
// calculating HST
hst=(book_price*13)/100;
total=book_price+hst;
printf("you have to pay %.2f as HST ",hst); //%w.nf where w = Integer number for total width of data and n is the number of digit printed after decimal point.
printf("the total cost of the book is %.2f ",total);
return 0;
}
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.