Conditional Statements

  • + 0 comments

    If you want a simple method (Very basic). you can use switch case. It will work just fine and also switch will come easier to write.

    include

    using namespace std;

    int main() {

    int n;
     cin>>n;
    
    
    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;
    
    
    return 0;
    

    }