der the following code segment, which is intended to store the sum of all multiples of 10 between 10 and 100, inclusive (10 + 20 + ... + 100), in the variable total. int x = 100; int total = 0; while( /* missing code */ ) { total = total + x; x = x - 10;

Respuesta :

ijeggs

Answer:

public class num10 {

   public static void main(String[] args){

       int num=10;

       int total =0;

   while (num<=100){

       if(num%10==0){

           System.out.print(num+"+");

           total+=num;

       }

       num++;

   }

       System.out.println(" is "+total);

   }

}

Explanation:

  • The problem is solved using Java programming language
  • The problem at hand is to compute the sum of all multiples of 10 between the numbers 10 and 100 inclusive, that is 10+20+30+40+50+60+70+80+90+100
  • Create two variables, num=10 and total =0
  • Create a while loop with the condition (num<=100) and increment num by 1 after each iteration
  • Within the while loop, use the modulo operator (%) to determine the multiples of 10 and add to total
  • See code and output attached

Ver imagen ijeggs

The code segment is an illustration of loops

Loops are used for operations that are to be performed repeatedly.

The missing code is x> 0

From the question, we understand that the code is to add up 10 to 100 (inclusive) with an increment of 10.

Variable x is initialized to 100, and it is reduced by 10 in each iteration.

So, the condition must be x > 0

i.e. the iteration must be repeated while x is greater than 0

Hence, the missing code is x > 0,

The complete code is:

int x = 100;

    int total = 0;

    while( x>0 ) {

total = total + x; x = x - 10;}

Read more about loops at:

https://brainly.com/question/16397886