4. Write a program to find the largest of three numbers using nested if else

 SOURCE CODE:


#include <stdio.h>

int main()
{   float a,b,c;
    printf("enter three numbers\n");
    scanf("%f %f %f",&a,&b,&c);
    if(a>b)
    {  if(a>c)
        printf("%f is greatest",a);
       else
       printf("%f is greatest",c);
    }
    else
    { if(b>c)
       printf("%f is greatest",b);
      else
      printf("%f is greatest",c);
    }
   

    return 0;
}

Comments