I'm a newbie of programming languages.
I have the following code
import javax.swing.*;
public class oddTest{
public static void odd(int a){
if (a < 0){
if (a % 2 != 0){
a++;
}
}
odd(--a);
}
public static void main(String[] args){
int n = 0;
String str = JOptionPane.showInputDialog(null, "make the limits = ");
n = Integer.parseInt(str);
odd(n);
JOptionPane.showInputDialog(n);
}
}
if i make the limits is 7, the output should be :
the output : 1, 3, 5, 7