Wednesday 9 March 2016

NEW or OLD


When parents take their kids for Engineering Counselling, they always go with apreconceived notion that older the college, better will be the quality of education offered. There is a help desk in front of the counselling hall to tell out of the colleges in which seats are available, which college is the older one. 
Nowadays, engineering counselling goes on for a month and the help desk needs to function on all days. So the Dean, Admissions decided to automate this task. 
Can you help him in this task? 
Given the year of establishment of 2 colleges, write a program to determine which college is the older one.

Input Format: 
Input consists of 2 integers. The first integer corresponds to the year of establishment of college 1 and the second integer corresponds to the year of establishment of college 2. 

Output Format: 
Output consists of the string “College 1 is older” or “College 2 is older”. Refer sample input and output for further formatting specifications. 

Sample Input and Output: 
[All text in bold corresponds to input and the rest corresponds to output] 

Enter the year of establishment of college 1 
2002 
Enter the year of establishment of college 2 
2008 
College 1 is older

Code:
  #include<stdio.h>
int main(){
  int y1,y2;
  printf("Enter the year of establishment of college 1\n");
  scanf("%d",&y1);
  printf("Enter the year of establishment of college 2\n");
  scanf("%d",&y2);
  if (y1>y2)
    printf("College 2 is older");
  else
    printf("College 1 is older");
  return 0;
}
  

2 comments:

  1. If I written the code like this, in output I'm getting "Year of the establishment" Also what I have to change

    ReplyDelete
  2. Where we want to enter 2002, 2008

    ReplyDelete