Ask Question
21 August, 11:18

1. Write a while loop that lets the user enter a number. The number should be multiplied by 10, and the result assigned to a variable named product. The loop should iterate as long as product is less than 100

+4
Answers (1)
  1. 21 August, 13:19
    0
    import java. util. Scanner;

    public class num6 {

    public static void main (String[] args) {

    Scanner in = new Scanner (System. in);

    int product=0;

    do{

    System. out. println ("Enter a number");

    int num = in. nextInt ();

    product = num*10;

    System. out. println ("The product is " + product);

    }while (product<100);

    }

    }

    Explanation:

    In the Java program above, The user will be prompted to enter a number.

    The number is multiplied by 10 and assigned to a variable called product.

    A do ... while loop has been implemented to check the variable product

    As long as this variable is less than 10, the user will be prompted to enter another number.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “1. Write a while loop that lets the user enter a number. The number should be multiplied by 10, and the result assigned to a variable named ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers