Chapter - 3: The Decision Control

Write a program to find the greatest of the three numbers entered through the keyboard using conditional operators.


K
Sections
3
Exercises

A

B

C

D

E

F

G

H

I

J

K

1

2

3

#include<stdio.h>
#include<conio.h>
int main()
{
	int a,b,c;
	
	printf("Enter three numbers : ");
	scanf("%d%d%d", &a,&b,&c);
	
	a>b&&a>c?printf("%d is the greatest.", a):(b>a&&b>c?printf("%d is the greatest.", b):printf("%d is the greatest.", c));
	
	getch();
	return 0;
}

© 2020 Garbage Valuegarbage value logo