One criteria for evaluating 2 different colleges is based on the student strength.
Write a C program to compare 2 colleges based on the student strength.
Input Format:
Input consists of 2 integers. The first integer corresponds to the number of students in college 1 and the second integer corresponds to the number of students in college 2.
Output Format:
Output consists of the string “College 1 is better” or “College 2 is better”. 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 number of students in college 1
1000
Enter the number of students in college 2
1200
College 2 is better
Code:
#include<stdio.h> int main(){ int s1,s2; printf("Enter the number of students in college 1\n"); scanf("%d",&s1); printf("Enter the number of students in college 2\n"); scanf("%d",&s2); if(s1<s2) printf("College 2 is better"); else printf("College 1 is better"); return 0; }
No comments:
Post a Comment