APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY Previous Years Question Paper & Answer

Course : B.Tech

Semester : S1 and S2

Year : 2018

Term : MARCH

Branch : BIOTECHNOLOGY

Scheme : 2015 Full Time

Course Code : CS 100

Page:6





PDF Text (Beta):

Nested for loop

A for loop inside another for loop is called nested for loop. Syntax

of Nested for loop

for (initialization; condition; increment/decrement)

{

statement(s);

C program to print all the composite numbers from 2 to a certain number entered by user.

(initialization; condition; increment/decrement)

{

statement (5);

#include
#include
int main()
{
int i,j,n;
printf("Enter
scanf("%d",&n);
for(i=2;i<=n;i++)

{

for(j=2;j<=(int) pow(i,0.5);j++)

{
if(i%j==0)
{

number:");

printf("%d is composite\n", i);

break;
}
) }

return 0;

}
Output

for

Similar Question Papers