C Program to Find the Largest Number Among Three Numbers

Greatest of three numbers in C programming (2)

Find Greatest of Three Numbers

The C program to find the greatest of three numbers requires the user to insert three integers. Flow chart is also used in C programming to find the greatest number among three integers inserted by the user. A simple if-else block is used to identify the greatest number.

Problem Description

C program to find the greatest of three numbers require the user to insert three integers. Flow chart is also used in C programming to find the greatest number among three integers inserted by the user. A simple if-else block is used to identify the greatest number. The program will ask the user to insert three integer variables. And on the basis of the inserted number, the program will equate and exhibit the greatest number as an output. This program uses no1, no2 & no3 as three integer variables that are represented number1, number2 and number3 respectively in the program.

Working

  • Step 1: Start
  • Step 2: Take three integer values from user.
  • Step 3: If no1 is greater than no2 and no3, printf “Number1 is greatest”.
  • Step 4: If no2 is greater than no1 and no3, printf “Number2 is greatest”.
  • Step 5: If both the conditions are false, then printf “Number3 is greatest”.
  • Step 6: Stop
    #include<stdio.h>
    int main()
    {
    int no1,no2,no3;
    
    //Prompt user to insert any three integer variables
    printf(\nInsert value of no1, no2 and no3:”);
    scanf(“%d %d %d”, &no1, &no2, &no3);

    //for check of number 1 is greater   
    if((no1 > no2) && (no1 > no3))
        printf(\n Number1 is greatest”);

    //weather number 2 is grater 
    else if((no2 > no3) && (no2 > no1)) 
        printf(\n Number2 is greatest”);

    //other conditions are false than number 3 is greater 
    else 
        printf(\n Number3 is greatest”); 
    return 0
    }
Output
 
Insert Value of No1, No2 and No3: 15, 200, 101
Number 2 is Greatest