-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathpiggybank.c
More file actions
50 lines (29 loc) · 769 Bytes
/
piggybank.c
File metadata and controls
50 lines (29 loc) · 769 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
43
44
45
46
47
48
49
50
/*Programmer Chase Singhofen
Date:9/29/2016
Specifications: How much in the piggy bank*/
#include<stdio.h>
#include<stdlib.h>
//Main Funftion
main()
{
//variables
double hd = 0.5, q = 0.25, d = 0.1, n = 0.05, p = 0.01;
double a1 = hd*0.5, a2 = q*0.25, a3 = d*0.1, a4 = n*0.05, a5 = p*0.01;
printf("How many hd!\n");//user prompt
scanf_s("%lf", &hd);
a1 = hd*0.5;
printf("How many q!\n");
scanf_s("%lf", &q);
a2 = q*0.25;
printf("How many d!\n");
scanf_s("%lf", &d);
a3 = d*0.1;
printf("How many n!\n");
scanf_s("%lf", &n);
a4 = n*0.05;
printf("How many p!\n");
scanf_s("%lf", &p);
a5 = p*0.01;
printf("Total is %.2lf\n", a1 + a2 + a3 + a4 + a5);
system("pause");
}//end main