-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdiscount.c
More file actions
37 lines (37 loc) · 982 Bytes
/
Copy pathdiscount.c
File metadata and controls
37 lines (37 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include<stdio.h>
int main()
{
int persons,days,children,discount;
float d1,d2,gtotal;
printf("Enter the number of person\n");
scanf("%d",&persons);
printf("Enter the number of days\n");
scanf("%d",&days);
float daycost=250.25*days;
float totalcost=daycost*persons;
//Discounts
if(persons>=5 && days>=10)
{
d1=(days*100.25);
printf("%f",d1);
}
printf("Value after dis %f\n",totalcost-d1);
printf("Enter number of children you want to take\n");
scanf("%d",&children);
if(children>0)
{
persons=+children;
d2=children*45.3;
float totald=d1+d2;
printf("You got two discounts with value %.2f\n",totald);
gtotal=(persons*250.25)-totald;
printf("Your grand value is %f",gtotal);
}
else
{
printf("You got the dicount of %.2f\n",d1);
gtotal=totalcost-d1;
printf("You grand value after discount is %.2f\n",gtotal);
}
return 0;
}