prev


Ternary Operator

29. Smallest of three numbers(9.7.2009)

/*
Program# 29
date : 25-12-2008
Smallest of three numbers
*/

#include <stdio.h>
main(){
int a,b,c,x,y;
printf("\nEnter three integers :");
scanf("%d %d %d",&a,&b,&c);
x=a<b?a:b;
y=x<c?x:c;
printf("\n%d : Smallest number\n",y);
}

output:
Enter three integers :3 2 1
1 : Smallest number

next
blog comments powered by Disqus