-
Notifications
You must be signed in to change notification settings - Fork 0
/
Numeric_representation.cpp
50 lines (45 loc) · 1.01 KB
/
Numeric_representation.cpp
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
/* Given a positive integer n, do the following:
If 1<n<9, then print the lowercase English word corresponding to the number (e.g., one for , two for , etc.); otherwise, print Greater than 9.
Constraints - 1<=n<=10^9
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
switch (n){
case 0:
cout<< "zero";
break;
case 1:
cout << "one";
break;
case 2:
cout << "two";
break;
case 3:
cout << "three";
break;
case 4:
cout << "four";
break;
case 5:
cout << "five";
break;
case 6:
cout << "six";
break;
case 7:
cout << "seven";
break;
case 8:
cout << "eight";
break;
case 9:
cout << "nine";
break;
default:
cout << "Greater than 9";
}
return 0;
}