filmov
tv
Java Practice It || 3.4 Odds || method basics

Показать описание
Question:
What output is produced by the following program?
public class Odds {
public static void main(String[] args) {
printOdds(3);
printOdds(17 / 2);
int x = 25;
printOdds(37 - x + 1);
}
public static void printOdds(int n) {
for (int i = 1; i {= n; i++) {
int odd = 2 * i - 1;
}
}
}
Problem:
What output is produced by the following program?
public class Odds {
public static void main(String[] args) {
printOdds(3);
printOdds(17 / 2);
int x = 25;
printOdds(37 - x + 1);
}
public static void printOdds(int n) {
for (int i = 1; i {= n; i++) {
int odd = 2 * i - 1;
}
}
}
Problem: