Please enter your email:

1. Which update prints numbers from 10 to 1?

for(i = 10; i >= 1; ?)
printf(“%d “, i);

 
 
 
 

2. Which initialization is correct to print numbers from 1 to 10?

for( ? ; i <= 10; i++)
printf(“%d “, i);

 
 
 
 

3. Which increment is correct to print numbers 1 to 10?

for(i = 1; i <= 10; ? )
printf(“%d “, i);

 
 
 
 

4. What is wrong in this loop?

for(i = 1; i <= 10; i- – )
printf(“%d “, i);

 
 
 
 

5. What is the output of this loop?

for(i = 1; i <= 5; i++)
printf(“%d “, i);

 
 
 
 

6. What should be inside loop to calculate factorial of n?

fact = 1;
for(i = 1; i <= n; i++)
?;

 
 
 
 

7. Which loop prints only odd numbers from 1 to 10?

for(i = 1; i <= 10; ?)
printf(“%d “, i);

 
 
 
 

8. To print multiplication table of n , what is inside loop?

 

 
 
 
 

9. What should be placed inside loop to print the sum of first n numbers?

sum = 0;
for(i = 1; i <= n; i++)
?;

 
 
 
 

10. Which loop prints only even numbers from 1 to 10?

for(i = 2; i <= 10; ?)
printf(“%d “, i);

 
 
 
 

Question 1 of 10

Leave a Reply

Your email address will not be published. Required fields are marked *

Chat Icon