Saturday, 13 December 2014

C program for Largest of two numbers


Write a program to find the largest of two number: (if-else statement)

#include<stdio.h>
#include<conio.h>
int main()
{
int a, b;
printf("Enter the two numbers");
scanf("%d %d",&a,&b);
if(a>b)
printf("The larger number is %d",a);
else
printf("The larger number is %d",b);
getch();
return(0);
}

OUTPUT:
Enter the two numbers
4 5
The larger number is 5

No comments:

Post a Comment