C Program to Find the Largest Number Among Three Numbers

Write a C program to 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. 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.


Greatest of three numbers in C programming (2)


Step 1: Start

Step 2: Prompt user to insert three integer variables

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, else printf “Number3 is greatest”.

Step 6: Stop

C program:-

int main()
   int no1,no2,no3;
   //Prompt user to insert any three integer variables
   printf("\nInsert value of no1, no2 and no3:");
   //Keep inserted values in variables for evaluation
   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; }


Insert value of no1, no2 and no3: 15, 200, 101
Number2 is greatest

Please Login/Signup to comment