Ad

Chapter - 3: The Decision Control

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


Ad
K
Sections
3
Exercises
#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;
}
Ad

© 2024 Garbage Valuegarbage value logo