Tuesday, January 24, 2012

Sample C Program To Find The Greatest Among Three Numbers.

#include
#include

void main()
{

int a, b, c;
clrscr();
printf(" Enter value of a, b & c: ");
scanf("%d %d %d",&a, &b, &c);

if( ( a>b ) && ( a>c ) )
printf(" a is greatest.");

if( ( b>c ) && ( b>a ) )
printf(" b is greatest.");

if( ( c>a ) && ( c>b ))
printf(" c is greatest.");

getch();

}

No comments:

Post a Comment