Saturday 19 March 2016

Railway – Seating arrangement for Sleeper Class


Write a program to determine the type of berth when the seat/berth number in the train is given.
Input Format: 
Input consists of a single integer. Assume that the range of input is between 1 and 72.
Output Format: 
Output consists of a single string. [Upper or Middle or Lower or Side Lower or Side Upper]

Sample Input 1: 
9
Sample Output 1: 
Lower

Sample Input 2: 
72
Sample Output 2: 
Side Upper





Code:
  #include<stdio.h>
#include<string.h>
int main(){
  int n,k;
  scanf("%d",&n);
  k=n%8;
  if(k==1 || k==4)
    printf("Lower");
  if(k==2 || k==5)
    printf("Middle");
  if(k==3 || k==6)
    printf("Upper");
  if (k==0)
    printf("Side Upper");
  if(k==7)
    printf("Side Lower");
           
           
           
    return 0;
}
    

5 comments:

  1. The rrb ntpc 2018 will recruit the candidates for various vacant posts in Technical and Non-Technical Categories.
    Railway Recruitment Boards of Indian Railways is providing around 26, 502 Vacancies for both ALP (17, 673) and Technicians (8829) Posts. The railway loco pilot Application form 2018 has been started from 3rd Feb 2018
    The Railway Recruitment Board has released the Official Notification CEN 2/2018 for the recruitment of Railway Group- “D” Posts. The online applications have been made available from 10th Feb 2018. check here for railway group d syllabus 2018
    The Railway Recruitment Board has published the rrb alp syllabus .
    RRB has been released official advertisement for railway group D and railway group d application form recruitment 2018.
    JEE Main 2018 Admit Card will be released in the 2nd week of March 2018. The Central Board of Secondary Education (CBSE) will conduct one of the most reputed engineering examinations in the many exam centers situated across the country. JEE Mains or Joint Entrance Examination Main is conducted for all those aspiring engineers and architects who wish to take admission in the reputed NITs, IIITs and CFTIs. Check here how to download the JEE Main Admit Card from the CBSE JEE Main official website.

    ReplyDelete
  2. Government Jobs offer an opportunity to turn your aspirations into reality. If you aspire to work in the mainstream and be a part of the nation's economic development, a job in the Government Sector may be the best option for you. Every year a number of job opportunities become available in the Government Sector.
    For more details - sarkarijob.ind.in
    The UP Police Admit Card 2018 will be released on the official website of the Uttar Pradesh Police Recruitment and Promotion Board (UPPRPB) prpb.gov.in.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete