0

write a java program to input both odd or both even number. display even series or odd series with the limit. display error message in a dialog box if one is even and other is odd?

5th Nov 2016, 1:39 PM
muskan
muskan - avatar
3 Respostas
0
make it clear first.... store the values in an array and if(a[I]%2==0) then even else odd
23rd Nov 2016, 6:56 AM
Somnath Ghosh
Somnath Ghosh - avatar
0
Scanner input = new Scanner (System.in); int a; System.out.print("enter a number: "); a=input.nextInt(); if (a%2==0) { System.out.print("even"); } else if (a!=1) { System.out.print("odd"); } else { System.out.print("neutral"); }
24th Nov 2016, 10:40 AM
Vanessa Añasco
Vanessa Añasco - avatar
0
Vanessa...else if part is not necessary.. check again
24th Nov 2016, 3:33 PM
Somnath Ghosh
Somnath Ghosh - avatar