Thursday, September 13, 2012

Greatest of two Numbers - Conditional Operator

/*******<soeasyprograms.blogspot.in>********/
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf(“enter the 2 numbers”);
scanf(“%d%d”,&a,&b);
(a>b?printf(“a is greater”):printf(“b is greater”));
getch();
}


Output:

enter the two numbers
6
3 a is greater

No comments:

Post a Comment