In: Computer Science
NOTE: I have completed program for your assignment. Please check and let me know if you have any questions. I will acknowledge back with a response within 24 hours. Thanks for your patience.
Code:
#include <stdio.h>
int main()
{
/* declaring variables */
int age, no_of_tickets;
double cost;
/* reading person age and tickets received */
printf("\nEnter the age of person: ");
scanf("%d", &age);
printf("\nEnter the number of tickets received: ");
scanf("%d", &no_of_tickets);
/* calculating insurance cost based on age and number of tickets */
if(age < 21)
cost = 1500 + (250 * no_of_tickets);
else if(age >= 21 && age <= 24)
cost = 1200 + (250 * no_of_tickets);
else if(age >= 25)
cost = 1000 + (200 * no_of_tickets);
printf("\nPersons age: %d", age);
printf("\nNumber of tickets: %d", no_of_tickets);
printf("\nInsurance Cost: %f", cost);
printf("\n");
return 0;
}
Code output screenshot: