-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut8.cpp
More file actions
75 lines (54 loc) · 1.33 KB
/
tut8.cpp
File metadata and controls
75 lines (54 loc) · 1.33 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
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
68
69
70
71
72
73
74
75
#include <iostream>
using namespace std;
int main()
{
//simple calculator//
int a;
cout<<" Enter the value of a: "<<endl;
cin>>a;
int b;
cout<<" Enter the value of b :"<<endl;
cin>>b;
char op;
cout<<" Enter the operation you want to perform : "<<endl;
cin>>op;
switch (op)
{
case '+':
cout<<(a+b)<<endl;
break;
case '-':
cout<<(a-b)<<endl;
break;
case '*':
cout<<(a*b)<<endl;
break;
case '/':
cout<<(a/b)<<endl;
break;
case '%':
cout<<(a%b)<<endl;
break;
default:
cout<<" Enter the valid operation "<<endl;
break;
}
//
// Homework
//Total amount = 1330
// How many 100note , 50,20 ,10
int amount=1330;
switch (1)
{
case 1:
cout<<amount/100<<endl;
amount = amount%100;
case 2:
cout<<(amount %100)/20<<endl;
case 3:
cout<<((amount %100)%20)/10<<endl;
default:
break;
}
return 0;
}