C Program to Find the Biggest of n Numbers
This C Program finds the highest of 5 numbers it checks the numbers using if else if construct no loops are used,you can draw a flow diagram to check how the numbers are found
#include<stdio.h>
main()
{
double a,b,c,d,e;
printf("BIGGEST OF FIVE NUMBERS n");
printf("Enter the first number n");
scanf("%lf",&a);
printf("Enter the second number n");
scanf("%lf",&b);
printf("Enter the third number n");
scanf("%lf",&c);
printf("Enter the fourth number n");
scanf("%lf",&d);
printf("Enter the fifth number n");
scanf("%lf",&e);
if (a>b&&a>c&&a>d&&a>e)
{
printf("%lf-is the biggest of all n",a);
}
else if (b>a&&b>c&&b>d&&b>e)
{
printf("%lf-is the biggest of all n",b);
}
else if (c>b&&c>a&&c>d&&c>e)
{
printf("%lf-is the biggest of alln",c);
}
else if (d>b&&d>c&&d>a&&d>e)
{
printf("%lf-is the biggest of alln",d);
}
else if (e>b&&e>c&&e>d&&e>a)
{
printf("%lf-is the biggest of alln",e);
}
}
OUTPUT:
BIGGEST OF FIVE NUMBERS
Enter the first number
1
Enter the second number
2
Enter the third number
5
Enter the fourth number
4
Enter the fifth number
19
19.00-is the biggest of all
Recent Comments