This was the assignment: If the first parameter is less than the second parameter add the two and print the result 10 times. THIS PROGRAM IS IN JAVA.

I did everything but I can't figure out how to print the result as a loop 10 times.

public static void main(String args[])

{
int x1;int x2;
x1=5;
x2=8;
if (x1<x2)
System.out.println(x1+x2);
}

}

How would I print the result as a loop ten times?

http://www.jiskha.com/display.cgi?id=1436026108

To print the result as a loop ten times, you need to use a loop construct such as a "for" loop. Here's how you can modify your code to achieve that:

```java
public static void main(String args[]) {
int x1;
int x2;

x1 = 5;
x2 = 8;

if (x1 < x2) {
for (int i = 0; i < 10; i++) {
System.out.println(x1 + x2);
}
}
}
```

In the code above, a "for" loop is added to the code block inside the "if" statement. The loop runs ten times because the condition `i < 10` is specified in the loop declaration (`for (int i = 0; i < 10; i++)`). The `System.out.println(x1 + x2);` line is executed ten times, printing the result of `x1 + x2` each time.

By adding this loop, the result will be printed as desired, ten times.