Programming In C
Improve your Programming Skills with almost every C Program.
Home
Blog Posts
Life Style
Relationship
Make Money
Follow Us
Facebook
Twitter
About Us
Who We Are?
Contact Us
Showing posts with label
conditional operators using for compairtion of three values
.
Show all posts
Showing posts with label
conditional operators using for compairtion of three values
.
Show all posts
Sunday, September 11, 2011
Ternary operator
Main features of
ternary operators
as follows :
There are three operand.
It works from left to right
Example of ternary operator is conditional operator. Symbol of conditional operator :
condition
?
True_parts
:
False_parts
Sunday, August 28, 2011
find greatest number using conditional operator
Q. Using conditional operators write a program to find out in three Numbers which is greatest number?
Ans.
#include
<
stdio.h
>
#include
<
conio.h
>
int
main()
{
int
n1,n2,n3;
prinft(
"Enter Numbers n1, n2, n3 : "
);
scanf(
"%d"%d%d"
,n1,n2,n3);
printf(
"Greatest=%d"
,n1>n2?n1>n3?x:z:y>z?y:z);
getch();
return
0
;
}
Output of above program :
Enter Numbers n1, n2, n3 :
10
20
30
Greatest=30
Older Posts
Home
Subscribe to:
Posts (Atom)