Saturday 22 June 2013

Write a program in C which finds the largest number between any three numbers.


Code:

#include<stdio.h>
#include<conio.h>
int main()
{
float a,b,c;
     printf("Enter values:\n");
     scanf("%f %f %f",&a,&b,&c);
if(a>b)
{
if(a>c)
     printf("\nThe largest value is%f",a);
else
     printf("\nThelargest value is %f",c);
}
else
{
if(c>b)
    printf("\n The largest value is %f",c);
else
    printf("\n The largest value is%f",b);
}
getch();
}
 


1 comment: