C program to find Greatest Of Two Numbers Using Conditional Operator
/* C Program to find Greatest of Two Numbers Using Conditional Operator.. */
1 2 3 4 5 6 7 8 9 10 11 |
#include<stdio.h> main() { int a,b,c; printf("\n Enter two Numbers: "); scanf("%d %d",&a,&b); // (a>b) is true then c=a else c=b c=(a>b)?a:b; printf("\n The Greatest number is : %d",c); return(0); } |
Sample Output: ( using GNU GCC Compiler with Code Blocks IDE )