-
Notifications
You must be signed in to change notification settings - Fork 1
/
gets.cpp
39 lines (32 loc) · 941 Bytes
/
gets.cpp
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
38
39
#include<stdio.h>
#include<string.h>
main()
{
int wc,cd,diets,cost,et,price,l,total;
char a[20];
/*
printf(" *********** MESS BILL ***********\n");
printf("\n Enter the worker charges : Rs.");
scanf("%d",&wc);
printf("\n Enter the number of compulsory diets:");
scanf("%d",&cd);
printf("\n Enter the number of diets taken :");
scanf("%d",&diets);
printf("\n Enter the cost per diet : Rs.");
scanf("%d",&cost);
*/
printf("\n Enter the numbers of packets of Lays(cost 20 rs.) :");
scanf("%d[^\n]",&l);
printf("Enter the name of any extra thing taken :");
gets(a);
printf("\n Enter the amount :");
scanf("%d",&et);
printf ("\n Enter the price of %s : Rs.",a);
scanf("%d",&price);
if(diets>cd)
total=wc+(cd*cost)+((diets-cd)*cost)+(l*20)+(et*price);
else
total=wc+(cd*cost)+(l*20)+(et*price);
printf("\n TOTAL BILL=%d",total);
return 0;
}