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

Popular posts from this blog

7. Write a program to construct a Fibonacci series upto n terms.

10. Write a program to find the sum of following series 1-X1/1!+X2/2!- ............Xn/n!.

5. Write a program to receive marks of physics, chemistry & maths from user & check its eligibility for course if a) Marks of physics > 40 b) Marks of chemistry > 50 c) Marks of math’s > 60 d) Total of physics & math’s marks > 150 or e) Total of three subjects marks > 200