asked 66.7k views
1 vote
What will the following code fragment print?

for (i = 0; i < 9; i++);

cout << i + 1;

cout << i;

asked
User Saggex
by
7.9k points

1 Answer

5 votes

Answer:

This code will print 109.

Step-by-step explanation:

Condition is the integer i is declared before the loop then the code will print 109. 10 because of the statement cout<<i+1; and 9 because of the cout<<i; . The for loop starts with 0 and ends when the value of i becomes 9. Since there is semi-colon after the for loop so the next statement after the for loop is not included in the loop.

answered
User Alex Jj
by
7.7k points
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.