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:11





PDF Text (Beta):

else
max=c;
printf(" Maximum 15 %d",max);

getch();

Loops

The versatility of computer lies in its ability to perform as set of instructions repeatedly. This involves a repeating
some position of a program either a specified number of a time or until a particular condition is being satisfied. This
repeative operation is done through a loop control structure.
There are 3 methods by way of which we can repeat a part of a program. They are

1. Using a while statement

2. Using a do while statement

3. Using a for while statement

While loop: It is a conditional control loop statement The while is an entry controlled loop statement. In entry
controlled loop, the control conditions are tested before start of the loop execution. If the conditions are not satisfied
then the body of the loop will not be executed.

General form

While (test condition) { Body of the loop }

The condition being tested may use relational or logical operators. Eg:

program to print "ന natural numbers while using loop.

main()

intn,
i=1;
"(۴
0
printf ("enter the values of n");
scanf ("%d", &n);

printf ("natural numbers from 1 to %d ", n);

while (i<=n)

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

Similar Question Papers