C Program to find Greatest number among three

find greatest among three numbers


In this tutorial you will learn how to write a program in C to find largest of three numbers.


Suppose if someone give 3 numbers as input 12, 15 and 10 then our program should return 15 as a output because 15 is a greatest among three.

C program to find greatest of three numbers in c

void main(){
	int a,b,c;
	printf("enter the value of a: ");
	printf("enter the value of b: ");
	printf("enter the value of c: ");
	if(a>=b && a>=c)
		printf(" a is greatest");
	if(b>=a && b>=c)
		printf(" b is greatest");
	if(c>=a && c>=b)
		printf("c is greatest");


greatest of three numbers in c

Explanation of greatest of three numbers in c language

  • This is very simple program to find the greatest number among 3 using C language.
  • There are 3 variables in the above program ‘a’, ‘b’, ‘c’ to take the 3 inputs from the users.
  • And also there are 3 if-else loop for the comparison of the numbers to find greatest one.
  • On the basis of comparison greatest number will be printed.

I hope you understood it.

Leave a Comment