Write a C Program find the largest number out of three without using nested if. - Pratik Ghelani

Pratik Ghelani

Breaking

Friday, January 11, 2019

Write a C Program find the largest number out of three without using nested if.

Program:-

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

    printf("Enter three different numbers: ");
    scanf("%lf %lf %lf", &a,&b,&c);

    if( a>=b && a>=c )
        printf("%.2f is the largest number.", a);

    if( b>=a && b>=c )
        printf("%.2f is the largest number.", b);

    if( c>=a && c>=b )
        printf("%.2f is the largest number.", c);
  

}

Output:-




No comments:

Post a Comment