PHOTO. I will give free candies to anyone who ans this
Attachments:
jenny2003:
i want candy but i don't know the answer
Answers
Answered by
2
(1) int a = 1; a<=2; The condition is true. It will enter the inner loop.
(i) int b = 1;1 < =4;
The condition is true, it will print *;
b++;
(ii) int b = 2; 2<=4;
The condition is true it will print *;
b++;
(iii) int b=3; 3<=4;
The condition is true it will print *;
b++;
(iv)int b = 4; 4<=4;
The condition is true, it will print *;
b++.
(v) b = 5 ; 5<=4.
The condition is false, It comes out of that loop.
The value will be ****.
(2) a = 2; a<=2 ---- The condition is true. It will enter the inner loop.
int b = 1;
Same process. it repeats until the expression is false.
Finally,
The output is:
****
****
Hope this helps!
(i) int b = 1;1 < =4;
The condition is true, it will print *;
b++;
(ii) int b = 2; 2<=4;
The condition is true it will print *;
b++;
(iii) int b=3; 3<=4;
The condition is true it will print *;
b++;
(iv)int b = 4; 4<=4;
The condition is true, it will print *;
b++.
(v) b = 5 ; 5<=4.
The condition is false, It comes out of that loop.
The value will be ****.
(2) a = 2; a<=2 ---- The condition is true. It will enter the inner loop.
int b = 1;
Same process. it repeats until the expression is false.
Finally,
The output is:
****
****
Hope this helps!
Similar questions
Social Sciences,
8 months ago
Science,
8 months ago
Math,
8 months ago
Computer Science,
1 year ago
Science,
1 year ago
Science,
1 year ago