Tuesday, 17 April 2018

Program To Find Maximum Of Three Number Using 'If else' Statement

/*program to find maximum of 3 number*/
#include <stdio.h>
void main ()
{
int a,b,c;
clrscr ();
printf ("/n Enter value of a :");
scanf ("%d", & a);
printf ("/n Enter value of b :");
scanf ("%d", & b);
printf ("/n Enter value of c :");
scanf ("%d", & c);
if ((a>>b)&&(a>>c))
printf ("/n a is maximum number:");
else if ((b>>a)&&(b>>c))
printf ("/n b is maximum number:");
else
printf ("/n c is maximum number:");
getch ();
}


Here is the program to find maximum of three number using 'if else ' statement . Here we have to use condition for only two times. First of all we have to declare three number and input the number from the user and then check the condition. These type of statement is also called ' Nested if else'.so we can write program from both of the ways. 

No comments:

Post a Comment

Featured post

Kalgudi Interview Round!!

Those who cleared the second round of kalgudi got an email from exceller to complete their Kalgudi Interview Round. So here we will discuss ...