Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java Question I can\'t figure this out I have tried so many diffrent ways. Instr

ID: 3774519 • Letter: J

Question

Java Question

I can't figure this out I have tried so many diffrent ways.

Instructions

Write a while loop that prints 1 to userNum, using the variable i. Follow each number (even the last one) by a space. Assume userNum is positive. Ex: userNum = 4 prints:

all of the code in bold can not be changed only the " /* Your solution goes here */ " can be changed this is in a learning program not an IDE

import java.util.Scanner;

public class CountDown {
   public static void main (String [] args) {
      int userNum = 0;
      int i = 0;

      userNum = 4;     // Assume positive

      /* Your solution goes here */

     System.out.println("");

      return;
   }
}

Thank You

Explanation / Answer

import java.util.Scanner;

public class CountDown {
   public static void main (String [] args) {
      int userNum = 0;
      int i = 0;

      userNum = 4;     // Assume positive

cout<<("userNum = %d ",userNum);

while(i != userNum) {

i++;

cout<<("%d",i);

}

cout << endl;

     System.out.println("");

      return;
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote