SWITCH_CASE - Editorial

[Practice](CodeChef: Practical coding for everyone SWITCH_CASE)

Author: Nilprasad Birajdar
Tester: Rushikesh Thakare
Editorialist: Shadab Shaikh

DIFFICULTY:

CAKEWALK

PREREQUISITES:

None

PROBLEM:

Given a number N, if the number is between 1 and 10 both inclusive then return the number in words (Lower case English Alphabets) otherwise return “not in range”.

.

.

SOLUTIONS:

Setter's Solution

#include
using namespace std;
int main(){

int t;
cin>>t;
while(t–){
int N;
cin>>N;
switch (N)

{
case 1: cout<<“one”<<endl; break;
case 2: cout<<“Two”<<endl; break;
case 3: cout<<“Three”<<endl;break;
case 4: cout<<“Four”<<endl; break;
case 5: cout<<“Five”<<endl; break;
case 6: cout<<“Six”<<endl; break;
case 7: cout<<“Seven”<<endl;break;
case 8 :cout<<“Eight”<<endl; break;
case 9: cout<<“Nine”<<endl;break;
case 10:cout<<“Ten”<<endl; break;
default :cout <<“not in range”<<endl;break;
}
}
return 0;
}