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

Program to find maximum of three number using user define function in C++

A function can be define by the user as per the requirement of the user or programmer . To implement a user define function , a programmer ...