Question 38 : Write a program in Java to to find whether a number is odd or even :
Java Program :
public class even_or_odd
{
public static void main(int a)
{
int b=a%2;
if (b==0)
System.out.println("The number "+a+" is an even one");
else
System.out.println("The number "+a+" is an odd one");
}
}
Java Program :
public class even_or_odd
{
public static void main(int a)
{
int b=a%2;
if (b==0)
System.out.println("The number "+a+" is an even one");
else
System.out.println("The number "+a+" is an odd one");
}
}
Its really helpful for me to understand where we i lost in my previous interview. Thanks.
ReplyDeleteIf anyone wants to Learn Java in Chennai go to the Besant Technologies which is No.1 Training Institute in Chennai.
http://www.javatraininginchennai.in