208k views
11 votes
.Write a Basic program to display first 10 natural numbers

(using IF… THEN ..ELSE (or) FOR..LOOP)​

2 Answers

9 votes

Step-by-step explanation:

CLS

x=1

For I = 1 to 10

Print x;

x = x+1

Next I

End

User Stason
by
4.3k points
11 votes

Answer:

Using for loop:

int i=0;

for(i=1;i<=10;i++)

{

printf(“%d”,i);

}

Using while loop:

int i=1;

while(i<=10)

{

printf(“%d”,i);

i++;

}

Using do while loop:

int i=1;

do

{

printf(“%d”,i);

i++;

}while(i<=10);

User Rick Ballard
by
4.3k points