Unknown error when printing solutions in for statment
I'm fairly new to java and I'm attempting to create a simple java program
that checks for arithmetic and geometric sequences and lists the desired
amount of terms from the sequence out. Everything in the program works
properly until the printing of the next terms in the for statement occurs.
There is no errors, and I can't find anything wrong. Any help is
appreciated.
if(num2-num1 == num3-num2){
d = num2-num1;
System.out.println("This is a arithmetic sequence.\nCommon Difference
= " + d);
System.out.println("How many terms of this sequence would you like?");
int a = scanner.nextInt();
for(int i = 1; i >= a; i++){
num3 += d;
System.out.println(num3);
}
suc = 1;
}
No comments:
Post a Comment