// Even odd using switch case
class EvenOdd
{
public static void main(String args[ ])
{
for( int i=1 ; i<=10 ; i++ )
{
switch( i )
{
case 1:
case 3:
case 5:
case 7:
case 9:
System.out.println( i + " - Odd Number." );
break;
case 2:
case 4:
case 6:
case 8:
case 10:
System.out.println( i + " - Even Number." );
break;
}
}
System.out.println( " The End. " );
}
}
Output:
1 - Odd Number.
2 - Even Number.
3 - Odd Number.
4 - Even Number.
5 - Odd Number.
6 - Even Number.
7 - Odd Number.
8 - Even Number.
9 - Odd Number.
10 - Even Number.
The End