1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Crazy boy [7]
3 years ago
6

Write a Java program named Problem 3 that prompts the user to enter two integers, a start value and end value ( you may assume t

hat the start value is less than the end value). As output, the program is to display the odd values from the start value to the end value. For example, if the user enters 2 and 14, the output would be 3, 5, 7, 9, 11, 13 and if the user enters 14 and 3, the output would be 3, 5, 7, 9, 11, 13.
Computers and Technology
1 answer:
Mashcka [7]3 years ago
5 0

Answer:

hope this helps

Explanation:

import java.util.Scanner;

public class Problem3 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.print("Enter start value: ");

       int start = in.nextInt();

       System.out.print("Enter end value: ");

       int end = in.nextInt();

       if (start > end) {

           int temp = start;

           start = end;

           end = temp;

       }

       for (int i = start; i <= end; i++) {

           if (i % 2 == 1) {

               System.out.print(i);

               if (i == end || i + 1 == end) {

                   System.out.println();

               } else {

                   System.out.print(", ");

               }

           }

       }

   }

}

You might be interested in
Why does the randomNumber function only use whole numbers between 0 and 1 (basically, 0 and 1)?
Bogdan [553]

Answer:

The randomNumber function only uses whole numbers between 0 and 1 because those are the unspecified minimum and maximums to get random numbers. If you want a larger range, <em>just specify the minimum and maximum.</em>

Explanation:

<em>Example code on how to specify a larger range, replace max and min with your maximum and minimum integers.</em>

function getRandomArbitrary(min, max) {

 return Math.random() * (max - min) + min;

}

6 0
3 years ago
Do all careers or professions need computer science? Why or why not?
hjlf

Answer:

Most careers or professions need computer science

Explanation:

As humanity is improving technological wise most jobs will be replaced and other jobs would come into play and in order for individuals to become employed in jobs that will be available in the future to come they will have to have a degree in computer science or know how to operate computers.

8 0
3 years ago
Read 2 more answers
Martin wants to calculate integer multiples up to 10 for a list of numbers. For example, he needs to multiply the first number i
kifflom [539]
A for loop.






----------------------------
5 0
4 years ago
Which two features offered by SharePoint
olganol [36]

Answer:

Collaboration.

Content Management.

Business Intelligence

Explanation:

5 0
3 years ago
The device used to control a heating system in the home is called a thermostat.
Makovka662 [10]
<span>The device used to control a heating system in the home is called a thermostat.
This is a true statement.
</span>
3 0
4 years ago
Other questions:
  • What is the most common concern with using variable frequency drives?
    6·1 answer
  • What is text box and label control​
    10·2 answers
  • Tim is trying to explain to his aunt how her computer works, but she does not understand what a CPU does. Which description will
    11·1 answer
  • The length of the hypotenuse of a right-angled triangle is the square root of the sum of the squares of the other two sides. Wri
    7·1 answer
  • Consider the relational schema below: Students(sid: integer, sname: string, major: string) Courses(cid: integer, cname: string,
    9·1 answer
  • It is not really important to organize your photos because you know that they are on your computer. (TRUE/FALSE)
    10·2 answers
  • How do i get around a school related block
    13·2 answers
  • Write an Algorithm to print only numbers from 10 to n times using iteration structure
    8·1 answer
  • What are software applications?
    14·1 answer
  • A security event popped up, alerting security of a suspicious user gaining access to, and copying files from, the %systemroot%\n
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!