Sunday, November 2, 2014

Filled Under: , , , ,

Program to print given number is even or odd numbers using conditional operator in command line argument .

Share


Code Box
------------------------------------------

/* Program to print given number is even or odd numbers using 
conditional operator in command line argument */


class evenc
{
public static void main(String x[])
{
int a;
String s;

a=Integer.parseInt(x[0]);

s=(a%2==0)?"a is even":"a is odd";

System.out.print("\n"+s);

}

}

0 comments:

Post a Comment