Semester : S1 and S2
Subject : Computer Programming
Year : 2017
Term : DECEMBER
Branch : BIOTECHNOLOGY
Scheme : 2015 Full Time
Course Code : CS 100
Page:4
The if statement may be implemented in different forms depending on the complexity of condition to be tested
simple if statement
if ...else statement
nested if ...else statement
else if ladder
ॐ ४० مر بر
1. Simple if statement:
General form: _ if
(test expression)
{
Statement—block;
Statement —x;
The statement-block may be a single statement (or) a group of statements. if the test statement is true, the
statement-block will be executed, other wise the statement block will be stopped & the execution will be jump to the
statement -×.
Note: when the condition is true, both the statement block & the statement-x are executed in sequence. Flowchart
for simple-if:
entry
fe 7 പ false _
true
= block
Next statement
Example: program to find max value of 2 numbers
main()
int a, b,max;