how to make a for loop go up by 2 code example
Example: java for increment by 2
int n = 2; //Or any other number
for (int i=0; i < 10; i+=n){
System.out.println(i) //This will print 0,2,4,6,8
}
int n = 2; //Or any other number
for (int i=0; i < 10; i+=n){
System.out.println(i) //This will print 0,2,4,6,8
}