Write a program to read three numbers from the keyboard and find the maximum out of these three numbers. (nested if-else)

if else program

#include <stdio.h>
int main() 
{ 
 int a,b,c;

 printf("\n Enter First Number  :");
 scanf("%d",&a);

 printf("\n Enter Second Number :");
 scanf("%d",&b);

 printf("\n Enter Third Number  :");
 scanf("%d",&c);
 
if(a>b)
   {
   if(a>c)
     {
     printf("\n First Number %d is maximum",a);
     }
     else
    {
    printf("\n Third Number %d is maximum",c);
    }
}
else {
         if(b>c)
            {
              printf("\n Second Number %d is maximum",b);
            }
         else
           {
            printf("\n Third Number %d is maximum",c);
           }
}
 
return 0;

}

 

You can get more c related programs and more here

http://projugaadu.com/category/topics/c-language/

Leave a Comment