-
Notifications
You must be signed in to change notification settings - Fork 0
/
cash.c
69 lines (43 loc) · 940 Bytes
/
cash.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
//begining
#include <cs50.h>
#include <math.h>
#include <stdio.h>
int main(void)
{
float n ;
int yahya = 0 ;
int x = 0 ;
do
{
n = get_float("change : ");
}
// adding conditions
while (n < 0);
x = round(n * 100);
while (x > 0)
{
if (x >= 25)
{
yahya = yahya + 1;
x = x - 25;
}
else if (x >= 10)
{
yahya = yahya + 1;
x = x - 10;
}
else if (x >= 5)
{
yahya = yahya + 1;
x = x - 5;
}
else if (x >= 1)
{
yahya = yahya + 1;
x = x - 1;
}
}
// printing the values
printf("Your total is yahya %d.\n", yahya);
printf("\n");
}