Question

1 int i, j, k; 2 for (i = 1; i <= 4; i++) 3 {...

1 int i, j, k;
2 for (i = 1; i <= 4; i++)
3 {
4 j = 1;
5 while (j < 4)
6 {
7 if (i % 2 == j % 2)
8 k = 100*i + 10*j;
9 else
10 k = 100*j + 10*i;
11 j++;
12 }
13 }

What will be the value of the variable k at the end of the third, sixth, ninth, and twelfth iteration of the while loop

0 0
Add a comment Improve this question Transcribed image text
Answer #1
******************************************************************************************
Please Upvote the answer as it matters to me a lot :)
*****************************************************************************************
As per HomeworkLib expert answering guidelines,Experts are supposed to answer only certain number of questions/sub-parts in a post.Please raise the remaining as a new question as per HomeworkLib guidelines.
******************************************************************************************

In iteration 1 the value of i is 1 j is 1 and the value of k is 110
In iteration 2 the value of i is 1 j is 2 and the value of k is 210
In iteration 3 the value of i is 1 j is 3 and the value of k is 130
In iteration 4 the value of i is 2 j is 1 and the value of k is 120
In iteration 5 the value of i is 2 j is 2 and the value of k is 220
In iteration 6 the value of i is 2 j is 3 and the value of k is 320
In iteration 7 the value of i is 3 j is 1 and the value of k is 310
In iteration 8 the value of i is 3 j is 2 and the value of k is 230
In iteration 9 the value of i is 3 j is 3 and the value of k is 330
In iteration 10 the value of i is 4 j is 1 and the value of k is 140
In iteration 11 the value of i is 4 j is 2 and the value of k is 420
In iteration 12 the value of i is 4 j is 3 and the value of k is 340
Add a comment
Know the answer?
Add Answer to:
1 int i, j, k; 2 for (i = 1; i <= 4; i++) 3 {...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT