Program to check entered number lies within range 1 to 10, 11 to 20, 21 to 30 or not if not print out of range using if else ladder

Program to check entered number lies within range 1 to 10, 11 to 20, 21 to 30 or not if not print out of range




Code

#include <bits/stdc++.h>

using namespace std;


int main() {

    

    int n;

    cin>>n;

    

    if(n>=1 && n<=10){

        cout<<"Between 1 to 10"<<endl;

    }

    else if(n>=11 && n<=20){

        cout<<"Between 11 to 20"<<endl;

    }

    else if(n>=21 && n<=30){

        cout<<"Between 21 to 30"<<endl;

    }

    else{

        cout<<"Out of Range"<<endl;

    }

    

    return 0;

}


Input 

17

Output

Between 11 to 20


Post a Comment

0 Comments