Input 3 Numbers and Print the Largest C Program

How to write a c program to input 3 numbers and print the largest in C Programming language ?



//Program to input 3 numbers and print the largest.
#include<stdio.h>
#include<conio.h>

void main()
{
int number_1, number_2, number_3;

clrscr();

printf("Enter a three numbers: ");
scanf("%d%d%d", &number_1, &number_2, &number_3);

if(number_1 >= number_2 && number_1 >= number_3)
printf("The number %d is the largest.", number_1);
else if(number_2 >= number_1 && number_2 >= number_3)
printf("The number %d is the largest.", number_2);
else
printf("The number %d is the largest.", number_3);

getch();
}


Learn More :