LAB SEATING ARRANGEMENT
Problem Description
There are 2 Programming Labs . Each with a seating capacity of 90. There are 240 students with registration numbers from 1 to 240. All 240 students cannot be accommodated in the labs at the same time. It has been decided to conduct theory class for 60 students every week. It has been planned to conduct theory classes for all students with register number being a multiple of 4. Students with registration number from to 1 to 120 with registration number not a multiple of 4 need to be seated in programming lab1 and students with registration numbers from 121 to 240 with registration numbers not a multiple of 4 need to be seated in programming lab II.
Given the registration number of student, write a C program to specify the lab or hall in which student need to be seated.
Input Format:
Input consists of 1 integer which corresponds to the registration number of the student.
Output format:
Output consists of string "Lab 1" or "Lab 2" or "Theory session" or "Incorrect Register Number"
Refer sample input and output for further formatting specifications.
Example 1:
99
Output=Lab 1
Example 2:
241
Output=Incorrect Register Number
CODING ARENA::
#include <stdio.h>
int main()
{
int a;
scanf("%d",&a);
if(a<=240)
{
if(a%4==0)
printf("Theory session");
else if(a>=1&&a<=120&&a%4!=0)
printf("Lab 1");
else if(a>=121&&a<=240&&a%4!=0)
printf("Lab 2");
}
else
printf("Incorrect Register Number");
return 0;
}
Test Case 1
Input (stdin)16
Expected Output
Theory session
Test Case 2
Input (stdin)239
Expected Output
Lab 2
No comments:
Post a Comment