#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
float regular_price = 10,
total_price = 0,
stud = 0.3,
kids_0_5 = 1,
kids_5_10 = 0.5,
over_60 = 0.2,
number_over_10 = 0.15;
int n_stud = 0,
& n_kids_0_5 = 0,
& n_kids_5_10 = 0,
& n_over_60 = 0,
& n_without_disc = 0,
& number = 0;
printf("enter number of students\n");
scanf("%d", &n_stud);
printf("enter number of the kids under 5\n");
scanf("%d", &n_kids_0_5);
printf("enter number of the kids between 5 and 10\n");
scanf("%d", &n_kids_5_10);
printf("enter number of visitors above 60\n");
scanf("%d", &n_over_60);
printf("enter number of visitors without any discounts\n");
scanf("%d", &n_without_disc);
number = n_stud + n_kids_0_5 + n_kids_5_10 + n_over_60 + n_without_disc;
total_price = regular_price * (n_stud * (1 - stud) + n_kids_0_5 * (1 - kids_0_5)
& + n_kids_5_10 * (1 - kids_5_10) + n_over_60 * (1 - over_60)
& + n_without_disc);
if (number >= 10)
& total_price *= (1 - number_over_10);
printf("\ntotal amount of tickets requested is - %d\n", number);
printf("total price is - %4.2f\n", total_price);
return 0;
}
Comments
Leave a comment