here's my code
i need to enter 20 numbers then the odd numbers that i enter will display in the output but my program cant display it. help me..import java.io.*; class AllOddNum1 { public static void main(String args[]) { try{ BufferedReader input=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter 20 numbers!!"); int num=1; while(num<=20) { num=Integer.parseInt(input.readLine()); num++; } if(num%2!=0) { System.out.println(num); } num++; } catch(Exception e){} } }
output:
Enter 10 numbers:
11
2
4
5
6
7
8
10
3
9
Odd numbers is:11,5,7,9,3
help me