Home / Programs / Program to find greatest in 3 numbers.
Programming Example

Program to find greatest in 3 numbers.

👁 1,286 Views
💻 Practical Program
📘 Step by Step Learning
Program to print a table of any number.

Program Code

/* Program to find greatest in 3 numbers.
  Author: Atnyla Developer */

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
 
	printf("enter value of a, b & c: ");
	scanf("%d%d%d",&a,&b,&c);
	
		if((a>b)&&(a>c))
			printf("a is greatest \n");
		if((b>c)&&(b>a))
			printf("b is greatest \n");
		if((c>a)&&(c>b))
		printf("c is greatest \n");
 
}

Output

enter value of a, b & c: 4  5  6
c is greatest
Press any key to continue . . .

Explanation

Program to print a table of any number.
		if((a>b)&&(a>c))
			printf("a is greatest \n");
		if((b>c)&&(b>a))
			printf("b is greatest \n");
		if((c>a)&&(c>b))
		printf("c is greatest \n");

How to learn from this program

First read the algorithm, then study the program code line by line. After that, compare the code with the output and finally go through the explanation. This approach helps learners understand both the logic and the implementation properly.