Question: Should the user's response in the limit variable look like this? limit = scan.nextLine (); public static void main(String[] args) { int limit; Scanner scan

Should the user's response in the "limit" variable look like this?

limit = scan.nextLine ();

public static void main(String[] args)

{

int limit;

Scanner scan = new Scanner (System.in);

// ASK THE USER HOW MANY TIMES THE MESSAGE SHOULD BE PRINTED

// STORE THE USER'S RESPONSE IN THE limit VARIABLE

int sum = 0;

int count = 1;

// CREATE A WHILE LOOP THAT WILL LOOP limit TIMES, PRINTING THE LINE

// NUMBER FOLLOWED BY "I love Computer Science"

// PRINT TO CONSOLE "Printed this message X times" WITH X = THE NUMBER OF

// TIMES THE LOOP WAS PERFORMED

// PRINT TO CONSOLE "The sum of the number from 1 to X is Y" WITH X = THE

// NUMBER OF TIMES THE LOOP WAS PERFORMED AND Y = THE TOTAL OF

// THE LINE NUMBERS

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!