Should the user’s response in the “limit” variable look like this?

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

}

}

Complete Answer:

Get Instant Help in Homework Asap
Get Instant Help in Homework Asap
Calculate your paper price
Pages (550 words)
Approximate price: -
Open chat
1
Hello 👋
Thank you for choosing our assignment help service!
How can I help you?