Answers for "conditional statements hackerrank solution in c++"

0

conditional statements hackerrank solution in c++

#include <bits/stdc++.h>

using namespace std;



int main()
{
    int n;
    cin >> n;
    cin.ignore(numeric_limits<streamsize>::max(), '\n');

    // Write Your Code Here
    if(1<=n && n<=9){
        if(n==1){
            cout<<"one"<<endl;
        } 
        else if(n==2){
            cout<<"two"<<endl;
        }
        else if(n==3){
            cout<<"three"<<endl;
        }
        else if(n==4){
            cout<<"four"<<endl;
        }
        else if(n==5){
            cout<<"five"<<endl;
        }
        else if(n==6){
            cout<<"six"<<endl;
        }
        else if(n==7){
            cout<<"seven"<<endl;
        }
        else if(n==8){
            cout<<"eight"<<endl;
        }
        else if(n==9){
            cout<<"nine"<<endl;
        }
    }
    else{
        cout<<"Greater than 9"<<endl;
    }

    return 0;
}
Posted by: Guest on August-17-2020

Code answers related to "conditional statements hackerrank solution in c++"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language