Rewrite Following Code Using Loop Instead Loop Variable Integer Provide First Line Loop As Q37272557

Rewrite the following code using a for loop instead of a whileloop. The variable i is an integer. Only provide the first line ofthe for loop. I am assuming the body of the for loop will onlycontain the print statement.

int i =1;

while (i <= 10) {
printf(“%dn”, i);
i++;
}


Answer


color{blue}Answer:for (int i = 1; i <= 10; i++)

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.