You are going to create an autogenerated list of numbers.   Ask a user for a random number between 1 and 25. Your program must create a list of numbers between 1 and the user-given number. BUT it should only include every second number. Display the list of numbers in a nicely formatted way. The numbers should be seperated by (",")(comma with no spaces)(notice the spaces on each side of the comma)   If the user types 19 the program will print:   1 , 3 , 5 , 7 , 9 , 11 , 13 , 15 , 17 , 19   Use a For loop to answer this question. Do not write a function or procedure. Only write the code. The output must match the above and the test case output formatting. For example Input Result 15 Please enter a number between 1 and 25: 1,3,5,7,9,11,13,15 12 Please enter a number between 1 and 25: 1,3,5,7,9,11 8 Please enter a number between 1 and 25: 1,3,5,7

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 4GZ
icon
Related questions
Question

You are going to create an autogenerated list of numbers.

 

Ask a user for a random number between 1 and 25.

Your program must create a list of numbers between 1 and the user-given number. BUT it should only include every second number.

Display the list of numbers in a nicely formatted way. The numbers should be seperated by (",")(comma with no spaces)(notice the spaces on each side of the comma)

 

If the user types 19 the program will print:

 

1 , 3 , 5 , 7 , 9 , 11 , 13 , 15 , 17 , 19

 

Use a For loop to answer this question.

Do not write a function or procedure. Only write the code.

The output must match the above and the test case output formatting.

For example

Input Result
15 Please enter a number between 1 and 25: 1,3,5,7,9,11,13,15
12 Please enter a number between 1 and 25: 1,3,5,7,9,11
8 Please enter a number between 1 and 25: 1,3,5,7
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Linked List Representation
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,