QUESTION 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.
TEST CASE 1
Theory session
TEST CASE 2
Lab 2
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.
INPUT
16
OUTPUT
Theory session
TEST CASE 2
INPUT
239
OUTPUT
Lab 2
EXPLANATION :
The code requires you to input a number and output the class room of the person , i.e. either Theory session or Lab 1 or Lab 2 .
The input will be an integer corresponding to the Registration Number of the student.
The output is the session that the person has to attend.
The code requires you to input a number and output the class room of the person , i.e. either Theory session or Lab 1 or Lab 2 .
The input will be an integer corresponding to the Registration Number of the student.
The output is the session that the person has to attend.
ALGORITHM :
- Accept the number from the user ( a )
- Check if the person has to attend theory session ( a%4==0&&a!=0 )
- Print Theory session if the case is true .
- If it is false , check for Lab 1 ( a<120&&a>=1 )
- Print Lab 1 if the case is true
- If it is false , check for Lab 2 ( a<240&&a>120 )
- Print Lab 1 if the case is true
- If all other cases are false check for wrong register number ( a>240||a<1 )
- Print Incorrect Register Number if the case is true
SOLUTION : (Please use this as reference only)
CODE |
No comments:
Post a Comment