Ternary operators

Current Categories - C-programming
 
*Ternary operators – A Ternary operator is an operator that operates on three operand and manipulates the operands to return some result.

->     ' ? ' - is known as ternary operator.

syntax:-    value1?value2:value3;

->     if value1 is true,then value2 is returned ,else value3.

Symbol Name
? conditional operator

Example-let us make a programm,which will take a integer number and find it whether it is greater than zero or not by using ternary operator.
 

*Output-

enter a number:10
greater than zero
copyright@
MyFreeCopyright.com Registered & Protected
 facebook-logo