EX.
NO: 3 LARGEST OF THREE NUMBERS
DATE:
AIM
To write a C program to find the largest of three numbers.
ALGORITHM:
Start
Read 3 numbers (A, B, C)
If A > B and A >C
o Print A is the Largest Number
Otherwise If B > A and B >C
o Print B is the Largest Number
Otherwise
Print C is the Largest Number
Stop
PROGRAM:
#include <stdio.h>
#include <conio.h>
void main() {
int A, B, C;
clrscr();
printf("Enter the numbers A, B, and C: ");
scanf("%d %d %d", &A, &B, &C);
if (A >= B && A >= C)
printf("%d is the largest number.", A);
else if (B >= A && B >= C)
printf("%d is the largest number.", B);
else
printf("%d is the largest number.", C);
getch();
}
RESULT:
Thus, the C program to find the largest of three numbers was executed successfully.