# C Program to Find Largest Number Among Three Numbers

## Write a C Program that Ask for Three Numbers and Find the Largest Number

In this tutorial, we will learn How to find largest number among the three numbers.

This problem consists of, when the program is run, it will ask three space-separated numbers in the console. After then it will output as follows: “The maximum number is: max” where max is the largest number.

## Algorithm – Find Largest Number

- In the main function, we will declare a total of 4 integer variables, three (

,**a**

,**b**

) for taking three integer values and the remaining one (**c**

) for putting the maximum number in it.**max** - The ask for three space-separated numbers using the

function and ensure that the values are stored correspondingly in variables a, b, and c.**scanf()** - Write the Business Logic to find the maximum number using if-else conditions
- After finding the number put that number in the

variable.**max** - Finally, display the number in the console using
`printf()`

function.

## Program – FInd Largest Number

```
#include <stdio.h>
int main()
{
int a, b, c, max;
printf("Enter three space-separated numbers: ");
scanf("%d%d%d", &a, &b, &c);
if ((a > b) && (a > c)) {
max = a;
} else if (b > c) {
max = b;
} else {
max = c;
}
printf("The maximum number is: %d\n", max);
return 0;
}
```

Sample Input | Sample Output |
---|---|

Enter three space-separated numbers: 5 9 2 | The maximum number is: 9 |

Enter three space-separated numbers: 150 44 109 | The maximum number is: 150 |

- C program to print Integer & Decimal number given by user
- C Program to perform all arithmetic calculation
- C program to ask two numbers and find their sum
- C program to check a number is even, odd or zero
- C program to swap between two numbers
- C program to sum of natural numbers up to N
- C program to calculate the factorial of a number
- C program to make a multiplication table
- C program to calculate GCD of two numbers
- C program to calculate LCM of two numbers
- C program to count number of digits in a number
- C program to reverse a integer number
- C program to find the power of a number
- C program to check whether a number is palindrome or not
- C program to count and print prime numbers up to the N
- C program to check armstrong numbers
- C program to check armstrong numbers between two integers
- C program to find factors of a number
- C program to fined the size of all data types
- C program to print largest number among three numbers
- C program to check a number is positive or negetive
- C program to calculate the factorial of a number
- C program to form any kind of pyramid and stracture
- C program to find all the prime numbers between two numbers
- C program to check whether a number is prime or not
- C program to make a simple calculator
- C program to calculate the perimeter of a rectangle
- C program to calculate the area of a rectangle
- C program to calculate the diameter and area of a circle
- C program to convert kilometer to meter and centimeter
- C program to convert temperature celsius to fahrenheit
- C program to convert temperature fahrenheit to celsius
- C program to ask for days and convert into years, week and days
- C program to calculate the square root of a given number
- C program to find third angle of a triangle where two angles are given
- C program to calculate the area of a triangle
- C program to calculate area of an equilateral triangle
- C program to calculate average and percentage of result
- C program to calculate simple loan interest
- C program to compound loan interest
- C program to display fibonacci series of a number
- C program to swap two numbers without using third variable
- C program to print Hello World without using semicolon
- C program to insert assembly code and run it
- C program to printf Hello world without main() function
- C program to to calculate the multiplication of two matrix
- C program to convert decimal numbers into binary
- C program to form a triangle made with alphabet
- C program to form a triangle made with numbers
- C program to form a fibonacci triangle
- C program to convert a number into charecters

Happy Coding ðŸ™‚