Berth of railway seat number
You are given a railway seat number as an integer, your task is to check whether it is a valid seat number or not. Also print its berth type i.e lower berth, middle berth, upper berth, side lower berth, side upper berth.
Example Of Train Berth Coach
Input Format:
The first line contains an Integer 't' which denotes the number of test cases or queries to be run. Then the test cases follow.
The first and the only line of input of each test case contains an integer, as described in the task.
Output format :
For each test case, the first and the only line of output prints the Birth type if valid otherwise prints "Invalid".
Birth types if valid are "Lower", "Middle", "Upper", "Side Lower" and "Side Upper".
Note:
The output of every test case is printed in a separate line.
You are not required to print anything explicitly. It has already been taken care of.
Constraints:
1 <= T <= 20
1 <= N <= 100
where N is the input berth seat number.
CodingNinjas
author
2y
Check if seat number is valid seat number or not(i.e in range of 1 to 72).
if (seat_number % 8) equals 1 or 4, then berth is a lower berth
if (seat_number % 8) equals 2 or 5, then berth is a middle bert...read more
CodingNinjas
author
2y
Berth of railway seat number
Check if seat number is valid seat number or not(i.e in range of 1 to 72).
- If (seat_number % 8) equals 1 or 4, then berth is a lower berth
- If (seat_number % 8) equals 2 or 5,...read more
Help your peers!
Add answer anonymously...
Top Josh Technology Group Software Engineer interview questions & answers
Popular interview questions of Software Engineer
>
Josh Technology Group Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app