I\'m trying to print this loop without the last comma. I\'ve been Googling about this and from what i\'ve seen everything seems overcomplex for such a small problem. Surely
Clunky solution, but hey - it works.
public static void atob(int a, int b){
int count = 1;
for(int i = a; i <= + b; i++) {
System.out.print(i);
if(count!=((b + 1) - a)) {
System.out.print(", ");
count++;
}
}
}
Alternatively, this works too.
public static void atob(int a, int b){
int count = 0;
for(int i = a; i <= + b; i++) {
if(count > 0){
System.out.print(", ");
}
System.out.print(i);
count++;
}
}