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:");
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 Volume of given box in java

class volume { public static void main (String args []) { int l=5,b=6,h=10; int volume; volume=l*b*h; System.out.println (" vol...