Program in C to find the greatest of three numbers

This problem may be solved by different patterns. Here we are providing the simplest method to find the greatest number between three numbers.

It can also be solved by nested if statement, else if ladder statement.

C Program to find greatest in 3 numbers Simply Define

#include<stdio.h>
 void main(){
 clrscr();
 int a,b,c;
 printf("enter two number");
 scanf("%d %d %d &amp;a &amp;b &amp;c"); 
if (a&gt;b &amp; &amp;a&gt;c); 
{ printf("a Is Gratest"); }
 else if(b&gt;c) 
{ printf("b Is Gratest"); } 
else { printf("c Is Gratest"); }
 getch(); }

Output:-Enter three number 10 20 30
C is greatest number

Explanation of Program :

In this program, we are taking three input numbers as an integer value from the keyboard a,b,c now we are applying if statement here, you can also solve this problem by using different statements. You can understand this example in an easy way by given below example.

a=10
b=20
c=30
First, we’re checking here
a>b && a>c if both conditions will true then a will be the greatest number else. Now we have only two numbers that are b and c.
Now we will check b>c here if b is greatest then the program will print b otherwise c will greatest.

This article is written by our awesome writer
Comments to: greatest of three numbers in C

Your email address will not be published. Required fields are marked *

Attach images - Only PNG, JPG, JPEG and GIF are supported.

New Dark Mode Is Here

Sign In to access the new Dark Mode reading option.

Join our Newsletter

Get our monthly recap with the latest news, articles and resources.

By subscribing you agree to our Privacy Policy.

Latest Articles

Explore Tutorials By Categories

About

Codeverb is simply an all in one interactive learning portal, we regularly add new topics and keep improving the existing ones, if you have any suggestions, questions, bugs issue or any other queries you can simply reach us via the contact page

Login

Welcome to Codeverb

Ready to learn something new?
Join Codeverb!

Read Smart, Save Time
  •  
    Strength indicator
  •  
  •  
    Log In | Lost Password