-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest64.c
More file actions
42 lines (31 loc) · 779 Bytes
/
test64.c
File metadata and controls
42 lines (31 loc) · 779 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
41
42
#include<stdio.h>
//question 2
void func(int m ,int p, int c)
{
int total1=0;
int temp2;
int temp1=(m/p);
int temp3=temp1;
while((temp3*c)>=p)
{
temp2=((c*temp3)/p);
temp3=((temp2*c)/p);
printf("%d\n",temp2);
printf("%d\n",temp3);
total1=temp2+temp3+total1;
}
int totalc=temp1+total1;
printf("total=%d\n",totalc);
}
int main()
{
int p,m,c;
int totalc;
printf("enter the total amount of money");
scanf("%d",&m);
printf("enter the price of chocolate");
scanf("%d",&p);
printf("enter the cashbck");
scanf("%d",&c);
func(m,p,c);
}