Monday 21 May 2012

Control constructs (if-else): PROGRAM TO FIND GREATEST AMONG THE TWO INPUTTED NUMBERS


#include<stdio.h>
#include<conio.h>
void main(){
int a;
int b;
clrscr();
printf("enter the value for a");
scanf("%d",&a);
printf("enter the value for b");
scanf("%d",&b);
if(a>b)
{
printf("A is greater= %d",a);
}
else if (a==b)
{
printf("Both values are equal");
}else
{
printf("B is greater=%d",b);
}
}
Output
enter the value for a 10
enter the value for b 5
A is greater=10

No comments:

Post a Comment