# C Program to find largest number among three numbers devquora

Posted On: Jan 26, 2023 ### Overview:

In this example, you'll learn to find the largest number among three numbers using if else statements. First of all, in this article, I will define numbers and then demonstrate the logic to find the largest number among the three. Moreover, I will write a logic and C program to find the largest number amongst the three numbers with output. At last, I will explain the execution of this program.

### What is a number?

A number is an object that uses digits to perform mathematical tasks. Calculus, which is a branch of mathematics, includes many numbers such as integers, whole numbers, real numbers, and imaginary numbers. Here, I will discuss numbers to perform arithmetic addition operations. Moreover, numbers are a combination of digits, some symbols, and decimal points. For instance, 127.23 is a rational number. There are many numbers such as whole numbers, natural numbers(positive integers), negative integers, rational numbers, etc.

### Demonstration how to find the largest number among three numbers ### Logic to find the largest number among three numbers

• Step 1:Read the three numbers to be compared, as A, B and C.
• Step 2:Check if A is greater than B.
• Step 3:If true, then check if A is greater than C.
• Step 4:If true, print 'A' as the greatest number.
• Step 5:If false, print 'C' as the greatest number.
• Step 6:If false, then check if B is greater than C.
• Step 7:If true, print 'B' as the greatest number.
• Step 8:If false, print 'C' as the greatest number.

### C program to find the largest number among three numbers with output

```#include  <stdio.h>
int main()
{
int A, B, C;

printf("Enter three numbers: \n");
scanf("%d %d %d", &A, &B, &C);

if (A >= B) {
if (A >= C)
printf("%d is the largest number.", A);
else
printf("%d is the largest number.", C);
}
else {
if (B >= C)
printf("%d is the largest number.", B);
else
printf("%d is the largest number.", C);
}

return 0;
}

```

The output of the Program: Enter the numbers: 8 45 1 45 is the largest number. Conclusion:

In this program, three numbers are assigned to the three variables one by one. Then, compare the two selected of them with the use of a comparison operator. Repeat the same process for the other two. After the successful execution of the program, the final largest number of the three is displayed on the screen.

Never Miss an Articles from us.

## Related Articles

#### C Program to convert Decimal to Binary Number

A Decimal Number is constructed with any digit from 0 to 9. For instance, 24 is a Decimal Number constructed from the digits 2 and 4. A Binary Number is constructed with digits 0 and 1. For instance, ..

#### C program to reverse a string

This program reversed the entered string that means opposite of the previous string sequence...

#### C program to reverse an Integer number

Are you want a demonstration of The C Program that reverses an Integer number? This Program reversing the sequence of digits in an Integer. After the successful compilation of the program, a message..