If Else Statement In C Language Ppt



C programming conditional operator is also known as a ternary operator. It takes three operands. Conditional operator is closely related with if..else statement.

Control structures are compound statements like if/then/else, while, for, and do.while that control how or whether their component statements are executed. Simple statements. The simplest kind of statement in C is an expression (followed by a semicolon, the terminator for all simple statements). Its value is computed and discarded. Output is as: Enter the three Ages of Ram,Sham and Ajay 14 17 19 Ram is Youngest. Ladder if or else if statement When in a complex problem number of condition arise in a sequence, then we can use Ladder-if or else if statement to solve the problem in a simple manner.

Syntax of C programming conditional operator

If the condition is true then expression1 is executed else expression2 is executed.

For example:

Here, puts statement contains as its second argument a conditional expression which evaluates to the string 'x is greater' if the condition x > y is true and 'y is greater' if the condition is false.It can also be done as

It can also be done as

Here, if x > y then puts('x is greater') else puts('y is greater').

The output of both expressions is same.

Example: C program to check whether the student is pass or fail using conditional operator

Output

Explanation

Ppt

If Else Statement C++ 11

The program checks the condition mark >=40, if it is true 'Passed' is printed else 'Failed'.

The above program can be simply done with the help of if...else statement.

If statements in c++ pdfIf else statement in c language ppt format

Programming In C Language

Output