Problem
Given the rating of a person, tell which division he belongs to. The rating range for each division are given below:
Division : Rating.
Division : Rating .
Division : Rating .
Input Format
- The first line of the input contains - the number of test cases. Then the test cases follow.
- Each testcase contains a single line of input, which contains a single integer .
Output Format
For each test case, output on a single line the answer: if the person belongs to Division , if the person belongs to Division , and if the person belongs to Division .
Constraints
Sample 1:
Input
Output
3 1500 4000 1900
3 1 2
Explanation:
Test case : Since the rating of the person lies in the range , he belongs to Division .
Test case : Since the rating of the person lies in the range , he belongs to Division .
Test case : Since the rating of the person lies in the range , he belongs to Division .
Program :
#include<stdio.h>
int main ()
{
int n,i,a;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d\n",&a);
if(a>=1000&&a<1600)
printf("3\n");
else if(a>=1600&&a<2000)
printf("2\n");
if(a>=2000&&a<=4500)
printf("1\n");
}
}
0 Comments