Ask Question

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

+5
Answers (1)
  1. 11 August, 19:29
    0
    import java. util. Scanner;

    public class TestClock {

    public static void main (String[] args) {

    Scanner in = new Scanner (System. in);

    System. out. println ("Enter two integer numbers");

    int num1 = in. nextInt ();

    int num2 = in. nextInt ();

    int newSum=num1+10;

    System. out. println ("The first number is "+num1);

    do{

    System. out. println (newSum);

    newSum + =10;

    }while (newSum <=num2);

    }

    }

    Explanation:

    Using Java Programming language

    Prompt user for the two inputs and save them as num1 and num2 (Using the scanner class) Create a new Variable newSum = num1+10 Create a do ... while loop to continually print the value of newSum, and increment it by 10 while it is less or equal to num2
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a program whose input is two integers. Output the first integer and subsequent increments of 10 as long as the value is less than or ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers