conditional statements hackerrank solution in c 2b 2b

Solutions on MaxInterview for conditional statements hackerrank solution in c 2b 2b by the best coders in the world

showing results for - "conditional statements hackerrank solution in c 2b 2b"
Giorgia
03 Nov 2019
1#include <bits/stdc++.h>
2
3using namespace std;
4
5
6
7int main()
8{
9    int n;
10    cin >> n;
11    cin.ignore(numeric_limits<streamsize>::max(), '\n');
12
13    // Write Your Code Here
14    if(1<=n && n<=9){
15        if(n==1){
16            cout<<"one"<<endl;
17        } 
18        else if(n==2){
19            cout<<"two"<<endl;
20        }
21        else if(n==3){
22            cout<<"three"<<endl;
23        }
24        else if(n==4){
25            cout<<"four"<<endl;
26        }
27        else if(n==5){
28            cout<<"five"<<endl;
29        }
30        else if(n==6){
31            cout<<"six"<<endl;
32        }
33        else if(n==7){
34            cout<<"seven"<<endl;
35        }
36        else if(n==8){
37            cout<<"eight"<<endl;
38        }
39        else if(n==9){
40            cout<<"nine"<<endl;
41        }
42    }
43    else{
44        cout<<"Greater than 9"<<endl;
45    }
46
47    return 0;
48}
49