-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmm.c
More file actions
40 lines (37 loc) · 1017 Bytes
/
mm.c
File metadata and controls
40 lines (37 loc) · 1017 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
38
39
40
#include <stdio.h>
struct product
{
int prize,quantity,total;
char product_name[20];
};
int main()
{
struct product s,*prt;
int sum=0;
char choice;
do
{
printf("Enter the product name-");
scanf("%s",s.product_name);
printf("\n Enter the prize per unit-");
scanf("%d",&s.prize);
printf("\n Enter Quantity-\t");
scanf("%d",&s.quantity);
sum=(s.prize*s.quantity);
s.total=sum;
printf("\nProduct Name-%s",s.product_name);
printf("\nproduct prize of unit-%d",s.prize);
printf("\nProduct Quantity\t-%d",s.quantity);
printf("\nProduct total amount-%d",s.total);
printf("\n you want to repeat(y/n)-");
fflush(stdin);
scanf("%c",&choice);
}
while(choice=='y');
prt=&s;
printf("\nProduct Name-%s",prt->product_name);
printf("\nproduct prize of unit-%d",prt->prize);
printf("\nProduct Quantity\t-%d",prt->quantity);
printf("\nProduct total amount-%d",prt->total);
return 0;
}