Wednesday 9 March 2016

MAXIMUM OF 2

Write a program to find the maximum of 2 numbers.

Input Format: 
Input consists of 2 lines. Each line consists of an integer.

Output Format: 
Output consists of a single line. Refer sample output for the format.

Sample Input 1: 
3
5

Sample Output 1: 
5 is the maximum number


Code:
  #include<stdio.h>
int main(){
  int a,b;
  scanf("%d",&a);
  scanf("%d",&b);
  if (a>b)
    printf("%d is the maximum number",a);
  else
    printf("%d is the maximum number",b);
 return 0;
}

No comments:

Post a Comment