#include<stdio.h> #include<conio.h> main() { int n1,n2,n3,s; printf("Enter the three numbers :\n"); scanf("%d %d %d",&n1,&n2,&n3); s=(n1<n2&&n1<n3?n1:n2<n3?n2:n3); printf("Smallest of given number is %d",s); getch(); } Output screenshot for smallest of three number Related programs: largest of three numbers using conditional operator. largest of n number without using conditional operator. Conditional operator in c.
No comments