Sunday, 15 July 2012

Conditional statement010

Determine the high value and same value of three input numbers.


#include <stdio.h>

#include <conio.h>

void main( )
{
int p = 0, q = 0, r = 0; 
clrscr ( );
printf ("\n Enter first number.....:"); scanf ("%d",&p);
printf ("\n Enter second number.....:"); scanf ("%d",&q);
printf ("\n Enter second number.....:"); scanf ("%d",&r);
if ( p == q && q == r)
printf ("\n Three numbers are same");
else               
{                
if ( P > q)
{         
if ( p > r)
printf ("\n First number is high value ");
else             
printf ("\n Third number is high value");
}
else
{        
if ( q > r )
printf ("\n Second number is high value");
else    
printf ("\n Third number is high value");
}
}
getch ( );

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...