Optimize website
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.

Download Application: Learn C Programming with Live Compiler

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

Flowchart : Program to check largest number

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
guest
0 Comments
Inline Feedbacks
View all comments

Join Our Newsletter Now

Get the latest tutorials, examples and projects updates.

!

Ads

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Disable Ad Block

Want Same System