Question

3.16 LAB: Output range with increment of 10 Write a program whose input is two integers,...

3.16 LAB: Output range with increment of 10

Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 10 as long as the value is less than or equal to the second integer.

Ex: If the input is:

-15 30

the output is:

-15 -5 5 15 25

Ex: If the second integer is less than the first as in:

20 5

the output is:

Second integer can't be less than the first.

For coding simplicity, output a space after every integer, including the last.

lab

activity

3.16.1: LAB: Output range with increment of 10

import java.util.Scanner;

public class LabProgram {

   public static void main(String[] args) {

      /* Type your code here. */

   }

}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import java.util.Scanner;

public class LabProgram {
public static void main(String[] args) {
Scanner input = new Scanner(System. in);
System.out.println("Enter the first integer: ");
int number1 = input. nextInt();

System.out.println("Enter the Second integer: ");
int number2 = input. nextInt();
int count=0;
if(number1<number2)
{
while(number1<number2)
{
if(count!=0)
{
number1=number1+10;
}
count++;
  
if(number1<number2)
System.out.println(number1);

}
}
else
{
System.out.println("Second integer cannot be less than first.");
}

}
}

Add a comment
Know the answer?
Add Answer to:
3.16 LAB: Output range with increment of 10 Write a program whose input is two integers,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 5.13 LAB: Output range with increment of 10 5.13 LAB: Output range with increment of 10...

    5.13 LAB: Output range with increment of 10 5.13 LAB: Output range with increment of 10 Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 10 as long as the value is less than or equal to the second integer Ex: If the input is -15 30, the output is: 15-5 5 15 25 Ex: If the second integer is less than the first as in 20 5, the output...

  • Write a program whose input is two integers, and whose output is the first integer

    5.20 (Ch 5) HW: Output range with increment of 10 Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 10 as long as the value is less than or equal to the second integer Ex: If the input is: -15 30 Then the output is: 15 -5 5 15 25 Ex: If the second integer is less than the first as in 20 5, the output is: Second integer can't be less than the...

  • Write a program whose input is two integers and whose output is the two integers swapped....

    Write a program whose input is two integers and whose output is the two integers swapped. Write in C language 7.3 LAB: Swapping variables Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 38 then the output is: 83 Your program must define and call a function. SwapValues returns the two values in swapped order. void SwapValues(int* userVali, int* userVal2) ACRIVITY 7.3.1: LAB: Swapping variables 0/10 ] main.c...

  • 8.10 LAB: Middle item Given a set of data, output the middle item (if even number...

    8.10 LAB: Middle item Given a set of data, output the middle item (if even number of items, output the two middle items). Assume that the data set will always contain less than 20 items. Ex: If the input is 579 11 13-1 (a negative indicates end), the output is: Ex: If the input is 57 911-1, the output is: 7 9 Hint: First read the data into an array. Then, based on the array's size, find the middle item(s)...

  • IN JAVA Write a program that first gets a list of integers from input. The input...

    IN JAVA Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, which indicates a threshold. Output all integers less than or equal to that last threshold value. Assume that the list will always contain fewer than 20 integers. Ex: If the input is: 5 50 60 140 200 75 100 the output is: 50 60 75...

  • Please draw a flow chart for each method please and thank you. Write a program that...

    Please draw a flow chart for each method please and thank you. Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, and output all integers less than or equal to that value. Assume that the list will always contain less than 20 integers. Ex: If the input is: 5 50 60 140 200 75 100 the...

  • How do I add the space that this Zybooks code keeps asking me to add? 5.13...

    How do I add the space that this Zybooks code keeps asking me to add? 5.13 LAB: Output numbers in reverse Write a program that reads a list of integers, and outputs those integers in reverse. The input begins with an integer indicating the number of integers that follow. For coding simplicity, follow each output integer by a space, including the last one. Assume that the list will always contain fewer than 20 integers. Ex: If the input is: 5...

  • 4.12 LAB: Smallest number Write a program whose inputs are three integers, and whose output is...

    4.12 LAB: Smallest number Write a program whose inputs are three integers, and whose output is the smallest of the three values. Ex: If the input is: 7 15 3 the output is: 3 I have to write this in python, having a hard time deciding how to approach this. Thank you!

  • *Coral Language* Write a program that first gets a list of six integers from input. The first five values are the intege...

    *Coral Language* Write a program that first gets a list of six integers from input. The first five values are the integer list. The last value is the upper threshold. Then output all integers less than or equal to the threshold value. Ex: If the input is 50 60 140 200 75 100, the output is: 50 60 75 For coding simplicity, follow every output value by a space, including the last one. Such functionality is common on sites like...

  • Java 6.16 LAB: Adjust list by normalizing

    When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This adjustment can be done by normalizing to values between 0 and 1, or throwing away outliers. For this program, adjust the values by dividing all values by the largest value. The input begins with an integer indicating the number of floating-point values that follow. Assume that the list will always contain fewer than 20 floating-point values. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: System.out.printf("%.2f", yourValue); Ex: If the input is: 5 30.0 50.0 10.0 100.0 65.0 the output is: 0.30 0.50 0.10 1.00 0.65  The 5 indicates that there are five floating-point values in the list, namely 30.0, 50.0, 10.0, 100.0, and 65.0. 100.0 is the largest value in the list, so each value is divided by 100.0. For coding simplicity, follow every output value by a space, including the last one. import java.util.Scanner;  public class LabProgram {    public static void main(String[] args) {       /* Type your code here. */    } }

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT