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
A(n)<br> is a fast compute with lots of storage. pls help
Pachacha [2.7K]

Answer:

Surface Laptop 3 - 15", Platinum (metal), AMD Ryzen 5 3580U, 8GB, 128GB

4 0
3 years ago
Read 2 more answers
What value(s) can be input into this code for the value of number that will cause the code in the loop to execute? Scanner keybo
Marianna [84]

Answer:

There is no value of the number variable, for which the loop can be true in any iteration.

Explanation:

  • The above loop states the condition that the value should be less than 100 and greater than 500. It is because the loop holds the and condition which gives the true if both conditions will be true.
  • The first condition of the while loop states that the value of the number variable is less than the 100.
  • The second condition of the while loop state that the value of the number variable is greater than the 500.
  • The and condition of the while loop will true if both conditions will true.
  • But there is no number which is less than 100 and greater than 500.
  • So no number can satisfy the while condition to be true.

5 0
3 years ago
True / Fasle
Liono4ka [1.6K]

Answer:

False

Explanation:

3 0
3 years ago
Why do people enjoy codehs
Alex73 [517]

Answer: this is a moral question, but here is my view

Explanation:

we get to learn about things like java which i am currently learning for AP computer science A

6 0
3 years ago
What feature did we use to quickly apply the formatting shown in this image?
hammer [34]

Answer:

Conditional formatting.

Explanation:

Conditional Formatting is the method that main objective to enabling the users for setting the formatting to the  cell or the cell range as well as it adjust the layout based that are based on the cell value or the formula value.

  • The Conditional formatting making the cell value as bold as in the given question we see that the cell value is bold  when the given condition is true.
  • The objective of pivot table is to summarizing the data it do not provide the formatting that's why this option is incorrect .
  • The objective of what if analysis is altering the absolute value of worksheet also it see how some modifications will influence the result of the worksheet formulae in the spreadsheet it do not provide the formatting that's why this option is incorrect .
  • Data scenario formatting do not provide the formatting that's why this option is incorrect .

3 0
3 years ago
Other questions:
  • When a typist changes from a conventional typewriter to a word processor, his typing schema will have to _____ to incorporate th
    12·1 answer
  • Why is linux referred to as open source software?
    6·1 answer
  • An organization's contact information includes its _____.
    9·2 answers
  • The maximum number of colors that should be used on a slide is _____. 2 4 6 8
    5·1 answer
  • In today's digital marketplace, the line between retailer and distributor has become less distinct.
    13·1 answer
  • Which website domains are most credible?
    6·2 answers
  • Which CSS attribute would change an element's font color to blue
    15·2 answers
  • What goals do you set for yourself while studying?
    9·2 answers
  • A simple C program to find the logarithm of any number in any base.....​
    13·1 answer
  • What three best practices can help defend against social engineering attacks?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!