This topic contains a solution. Click here to go to the answer

Author Question: Which of the following loops produces the output?1 2 3 4 1 2 3 1 2 1(I) for (int i = 5; i > 0; i--) ... (Read 34 times)

vicky

  • Hero Member
  • *****
  • Posts: 586
Which of the following loops produces the output?

1 2 3 4 1 2 3 1 2 1

(I)
for (int i = 5; i > 0; i--) {
for (int j = 1; j < i; j++)
System.out.print(j + " ");
System.out.println();
}

(II)
for (int i = 1; i < 5; i++) {
for (int j = 1; j < i; j++)
System.out.print(j + " ");
System.out.println();
}

(III)
int i = 0;
while (i < 5) {
for (int j = 1; j < i; j++)
System.out.print(j + " ");
System.out.println();
i++;
}

(IV)
int i = 5;
while (i > 0) {
for (int j = 1; j < i; j++)
System.out.print(j + " ");
System.out.println();
i--;
}

◦ (I)
◦ (II)
◦ (III)
◦ (IV)


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by vicky on May 6, 2020

coyin

  • Sr. Member
  • ****
  • Posts: 334
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 39% of students answer this correctly




vicky

  • Member
  • Posts: 586
Reply 2 on: May 6, 2020
Wow, this really help


Hdosisshsbshs

  • Member
  • Posts: 315
Reply 3 on: Yesterday
Thanks for the timely response, appreciate it

 

Did you know?

Medications that are definitely not safe to take when breastfeeding include radioactive drugs, antimetabolites, some cancer (chemotherapy) agents, bromocriptine, ergotamine, methotrexate, and cyclosporine.

Did you know?

There are major differences in the metabolism of morphine and the illegal drug heroin. Morphine mostly produces its CNS effects through m-receptors, and at k- and d-receptors. Heroin has a slight affinity for opiate receptors. Most of its actions are due to metabolism to active metabolites (6-acetylmorphine, morphine, and morphine-6-glucuronide).

Did you know?

Drugs are in development that may cure asthma and hay fever once and for all. They target leukotrienes, which are known to cause tightening of the air passages in the lungs and increase mucus productions in nasal passages.

Did you know?

Most women experience menopause in their 50s. However, in 1994, an Italian woman gave birth to a baby boy when she was 61 years old.

Did you know?

The average human gut is home to perhaps 500 to 1,000 different species of bacteria.

For a complete list of videos, visit our video library