-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroceryshopping.c
279 lines (140 loc) · 4.01 KB
/
groceryshopping.c
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
#include<stdio.h>
void veg();
void fruits();
void exotic();
void nv();
int main()
{
int choice,a,b,c,d,e,buy;
char add[300];
printf("Welcome\n Press '1' if you want to know the price of vegetables\n '2' for fruits\n '3' for exotic and non vegetarian products\n");
scanf("%d",&choice);
if(choice==1){
veg();
}
else if(choice==2){
fruits();
}
else if(choice==3){
printf("Press '1' for exotic food items and '2' for non vegetarian products\n");
scanf("%d",&c);
if(c==1){
exotic();
}
else{
nv();
}
}
printf("\nDo you want to buy it?\n Enter 1 for yes and 2 for no:");
scanf("%d",&buy);
if(buy==1){
printf("Enter the address:");
scanf("%s",add);
printf("COD is available\n The product will be delivered in 3-4 shipping days.\n Thank you for shopping with us.");
}
else
printf("Hope we helped you!\nVisit again...");
return 0;
}
void veg()
{
int a;
printf("Press the following number against the vegetable you want to buy mentioned below:\n");
printf("Potato-1\n Onion-2\n Ginger-3\n Garlic-4\n Tomato-5\n Jackfruit-6\n Green Peas-7\n Drumsticks-8\n Raddish-9\n Chilli-10\n");
scanf("%d",&a);
if (a==1)
printf("The price per kg is 40");
else if(a==2)
printf("The price per kg is 30");
else if(a==3)
printf("The price per 1/4 kg is 20");
else if(a==4)
printf("The price per 1/4 kg is 20");
else if(a==5)
printf("The price per kg is 15");
else if(a==6)
printf("The price per kg is 50");
else if(a==7)
printf("The price per kg is 80");
else if(a==8)
printf("The price unit is 10");
else if(a==9)
printf("The price per kg is 45");
else if(a==10)
printf("The price per 1/4 kg is 10");
}
void fruits()
{
int b;
printf("Press the following number against the fruit you want to buy mentioned below:\n");
printf("Apple-1\n Banana-2\n Orange-3\n Mango-4\n Watermelon-5\n Kiwi-6\n Avocado-7\n Pomegranate-8\n Grapes-9\n Muskmelon-10\n");
scanf("%d",&b);
if(b==1)
printf("The price per kg is 140");
else if(b==2)
printf("The price per dosen is 40");
else if (b==3)
printf("The price per kg is 80");
else if (b==4)
printf("The price per kg is 60");
else if (b==5)
printf("The price per kg is 40");
else if (b==6)
printf("The price for 3 units is 120");
else if (b==7)
printf("The price for 2 units is 99");
else if (b==8)
printf("The price per 1/2 kg is 150");
else if (b==9)
printf("The price per kg is 200");
else if (b==10)
printf("The price per unit is 30");
}
void exotic()
{
int d;
printf("Press the following number against the product you want to buy mentioned below:\n");
printf("Baby Corn-1\n Asparagus Beans-2\n Bell Pepper-3\n Brocolli-4\n Chinese Cabbage-5\n Dragon Fruit-6\n Zuchini-7\n Parsley-8\n Jalapeno-9\n");
scanf("%d",&d);
if(d==1)
printf("The price per kg is 150");
else if(d==2)
printf("The price per kg is 70");
else if(d==3)
printf("The price per kg is 208");
else if(d==4)
printf("The price per kg is 90");
else if(d==5)
printf("The price per kg is 40");
else if(d==6)
printf("The price per piece is 125");
else if(d==7)
printf("The price per kg is 124");
else if(d==8)
printf("The price per kg is 320");
else if(d==9)
printf("The price per 1/5 kg is 100");
}
void nv()
{
int e;
printf("Press the following number against the product you want to buy mentioned below:\n");
printf("Egg-1\n Chicken-2\n Fish-3\n Mutton-4\n Prawn-5\n Squid-6\n Beef-7\n Crab-8\n");
scanf("%d",&e);
if (e==1)
printf("The price for 6 pieces is 30");
else if (e==2)
printf("The price per kg is 240");
else if (e==3)
printf("The price per kg is 180");
else if (e==4)
printf("The price per kg is 800");
else if (e==5)
printf("The price per kg is 350");
else if (e==6)
printf("The price per kg is 400");
else if (e==7)
printf("The price per kg is 160");
else if (e==2)
printf("The price per kg is 500");
}