free c programming course
Tuesday, 17 January 2012
Greatest of two Numbers - Conditional Operator
#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
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment