APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY Previous Years Question Paper & Answer

Course : B.Tech

Semester : S1 and S2

Year : 2017

Term : DECEMBER

Branch : BIOTECHNOLOGY

Scheme : 2015 Full Time

Course Code : CS 100

Page:14





PDF Text (Beta):

printf("%d\t",i);

i++;
}while(i<=n);
getch();

}
FOR Loop
The for loop is another entry controlled loop that provides a more concise loop control structure.

The general form of for loop is
for(initialization; test condition; increment)

{
Body of the loop

}

1.The initializing control variables using assignment statement such as i=1&count=0,we can initialize control
variables. The variables | & count are known 35

LOOP CONTROL VARIABLES 2. The value of control is tested using the test condition. The test condition is a relational
expression, such as i<10 determine, when the loop will exit. If condition is true ,the body will executed otherwise the
execution continues with the statement that immediately follows the loop.

3. When the body of the loop is executed, the control is transferred back to for statement after evaluating the last
statement in the loop. Now the control variable is incremented using assignment statement such as i=i+1 and the
new value of control variable is again tested to see whether the loop condition is satisfied or not. Ex: To print 1 to
100 digits

01 #include

02 #include > conio.h>

03 void main()

04 {

05 0501);

06 for(i=1,i<=100,i++)

07 {
O8printf("%d/t" i);

09 }

10 getch();

11 }

12

Ex: To print multiplication table of any numbers from 1 to 20

01 #include

Similar Question Papers