Asked by Trish Goal
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);
}
}
}
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
There are no human answers yet.
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.