Sunday 5 January 2014

Find greatest number among three numbers in C

Find greatest number among three numbers in C

Find greatest number among three numbers in C. Here we can find greatest number using a conditional operator.

#include<stdio.h>
#include<conio.h>

void main()
{
int a,b,c,l;
clrscr();
printf("ENTER THREE VALUES\n");
scanf("%d%d%d",&a,&b,&c);
l=a>b&&a>c?a:(b>c)?b:c;
printf("LARGEST VALUE=%d",l);
getch();
}

Output


largest no between three number

No comments:

Post a Comment