QUESTION
Given a number as input, if the number is between 1 and 10 both inclusive then print the number in words otherwise print \”\”not in range\”\”.\n\nInput: \nFirst line of input contains an integer T which denotes the number of test cases. Then T test cases follows. First line of each test case contains an integer N.\n \n\nOutput: \nFor each test case, if the number is between 1 and 10 both inclusive then print the number in words in small cases otherwise print \”\”not in range\”\” \n\n\nConstraints:\n\n1<=T<=1000\n1<=N<=100.
“TESTCASE_1”: “5\n5\n6\n12\n2\n10\n###—###SEPERATOR—###—\nfive\nsix\nnot in range\ntwo\nten”, “TESTCASE_2”: “4\n9\n7 \n11\n8\n###—###SEPERATOR—###—\nnine\nseven\nnot in range\neight”, “TESTCASE_3”: “0\n###—###SEPERATOR—###—\n0”, “TESTCASE_4”: “0\n###—###SEPERATOR—###—\n0”, “TESTCASE_5”: “0\n###—###SEPERATOR—###—\n0
ANSWER
#include <iostream>
using namespace std;
int main()
{
int n,i,a[100];
scanf("%d",&n);
for(i=1;i<=n;i++)
cin>>a[i];
for(i=1;i<=n;i++)
{
if(a[i]>=1 && a[i]<=10)
{
if(a[i]==1)
cout<<"one\n";
else if(a[i]==2)
cout<<"two\n";
else if(a[i]==3)
cout<<"three\n";
else if(a[i]==4)
cout<<"four\n";
else if(a[i]==5)
cout<<"five\n";
else if(a[i]==6)
cout<<"six\n";
else if(a[i]==7)
cout<<"seven\n";
else if(a[i]==8)
cout<<"eight\n";
else if(a[i]==9)
cout<<"nine\n";
else if(a[i]==10)
cout<<"ten\n";
}
else
cout<<"not in range\n";
}
return 0;
}