Guest User

Untitled

a guest
Jul 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. void main()
  2. {
  3. int numTickets;
  4. float discount;
  5. float total = 0.0;
  6. int numKids = 0;
  7. float ticketPrice = 19.00;
  8. printf("Enter number of tickets: ");
  9. scanf("%d", &numTickets);
  10. if (numTickets > 10)
  11. {
  12. discount = 0.15;
  13. }
  14. else
  15. {
  16. discount = 0.0;
  17. }
  18. printf("Enter number of children: ");
  19. scanf("%d", &numKids);
  20. total = numKids*ticketPrice/2.0 + (numTickets – numKids)*ticketPrice;
  21. total = total*(1.0 – discount);
  22. printf("Total = %.2f n", total);
  23. }
Add Comment
Please, Sign In to add comment