-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVariablesOperatorsPractice.cpp
More file actions
38 lines (29 loc) · 1.02 KB
/
VariablesOperatorsPractice.cpp
File metadata and controls
38 lines (29 loc) · 1.02 KB
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
#include<iostream>
using namespace std;
int main(){
int total_cents;
int remaining_cents, num_quarters, num_dimes, num_nickles, num_pennies;
// ask user for input and stores it
cout << "Enter the amount of change you would like to split: " << endl;
cin >> total_cents;
num_quarters = total_cents/25;
remaining_cents = total_cents%25;
//num cents after finding quarters
num_dimes = remaining_cents/10;
remaining_cents%=10;
//num cents after finding quarters and dimes
num_nickles = remaining_cents/5;
num_pennies = remaining_cents%5;
//num cents after quarters, dimes, and nickels.
cout << "Your change is: " << endl;
cout << "Quarters: " << num_quarters << endl;
cout << "Dimes: " << num_dimes << endl;
cout << "Nickles: " << num_nickles << endl;
cout << "Pennies: " << num_pennies << endl;
//prints all values
// Character Practice
// char temp = 97;
// temp-= 32;
// cout << temp;
return 0;
}