I'm writing a for-loop for an assignment in school. The loop will write the min number, ex. 26 and will increase with 7 every turn in the loop until it reaches max, ex. 112. Between every number, the will also be written a comma - ",". But not after the last number.
Right now my code looks like this:
int min=26;
int max=112;
for(int i=min; i<=max; i+=7)
{
if(i!=max)
{
System.out.print(i+", ");
}
else
{
System.out.print(i);
}
}
Right now the last number will have a comma... Where's my problem?