n
, включая шаг step
?public class LoopWithStep {
int res = getSum(5, 10);
public static int getSum(int n, int step) {
int result = 0;
for (int i = 0; i < n; i++) {
result += i;
}
return result;
}
}
public class LoopWithStep {
int res = getSum(5, 10);
public static int getSum(int n, int step) {
int result = 0;
for (int i = 0; i <= n; i = i + step) {
result += i;
}
return result;
}
}