C Programming language

C Program example: Find greatest number of any three given numbers
Previous Home Next
Greatest number of any three given numbers

In this we are declaring three variables a,b,c. We insert values from keyboard into these values. Then check the conditions .Here we are using && operator two check two condition at a time. This operator is also called short circuit operator. This operator returns true if both value is true else it returns false.

/* Greatest number of any three given numbers */

void main()
	int a,b,c;
	printf("Enter the three numbers\t");
	if(a>b && a>c)
		printf("%d is greatest number",a);
	else if(b>c && b>a)
		printf("%d is greatest number",b);
		printf("%d is greatest number",c);
Output :

Enter the three numbers 1  2  3

3 is greatest number

Previous Home Next