Courses

### Courses

Structure and Union

No Examples found for this topic - CodeHelpPro

Data Files

No Examples found for this topic - CodeHelpPro
Jun 022021

# Program to check largest number

0 Suresh Chand June 2, 2021

This is the C program to check the largest number among the three numbers. We will use if else condition to check the largest number. To understand this example, You must have knowledge of the following topics.

## Algorithm

This is the algorithm of this program

Step 1: Start
Step 2: Initialize three variables a, b and c
Step 3: Take input from user and store in a, b and c
Step 4: IF a > b and a > c THEN
Print a is largest
Step 5: ELSE IF b > a and b > c THEN
Print b is largest
Step 6: ELSE
Print c is largest
Step 7: End

## Flowchart

This is the flowchart of this program

## CODE: Program to check largest number

Now, We will see the code to check the largest number.

#include <stdio.h>

int main(){

int a, b, c;
printf("Enter three numbers : ");
scanf("%d%d%d", &a, &b, &c);

if( a > b && a > c ){
printf("%d is largest number.", a);
}else if( b > a && b > c ){
printf("%d is largest number.", b);
}else{
printf("%d is largest number.", c);
}

return 0;
}

The output of above program is

Enter three numbers : 1
2
3
3 is largest number.
Subscribe
Notify of
Inline Feedbacks