C program to find largest number out of three numbers
/* C program to find largest number out of three numbers */#include <stdio.h>
#include<conio.h>
void main()
{
int a, b, c;
printf("Enter the values of a, b and c: ");
scanf("%d%d%d", &a, &b, &c);
if (a>b && a>c)
{
printf("A is largest number = %d",a);
}
if (b>a && b>c)
{
printf("B is largest number = %d",b);
}
if (c>a && c>b)
{
printf("C is largest number = %d",c);
}
getch();
}
Expected Output:
Enter the values of a, b and c:
5
9
7
B is largest number =9
OR
/* C program to find largest number out of three numbers */
#include <stdio.h>
#include <conio.h>int main()
{
int a, b, c;
printf("Enter a,b,c: ");
scanf("%d %d %d", &a, &b, &c);
if (a > b && a > c)
{
printf("a is Greater than b and c");
}
else if (b > a && b > c)
{
printf("b is Greater than a and c");
}
else if (c > a && c > b)
{
printf("c is Greater than a and b");
}
getch();
}
Expected Output:
Enter the values of a, b and c:
5
9
7
B is largest number =9
Tags:
C program to find largest number out of three numbers
c programs
largest numbers in three
three numbers