Question

I posted this question before. The assignment was: write a Java method if the first parameter is less than the second parameter add the two and print the result ten times.

How do I write the result 10 times as a loop? This is what I've got but I have a ton of errors that I can't figure out.

public class IfHomeworkThree
{

public static void main(String args[])

{
int x1;int x2;
x1=10;
x2=2;
if (x1>x2)
System.out.println(x1-x2);
}


for(int i=8;i<10;i++){
System.out.println("Count is: " + i);
}
}
}

Answers

Related Questions