Hey Guys,
Here we discussed about Even or Odd Values.
First time we input a values.And then i'll check it's what kind of value like even or odd value.
Example ↬
import java.util.Scanner;
class EvenOdd
{
public static void main(String args[])
{
int a;
Scanner obj=new Scanner(System.in);
System.out.print("Enter first value : ");
a=obj.nextInt();
if(a%2==0)
{
System.out.println("Entered value is Even");
}
else
{
System.out.println("Entered value is Odd");
}
}
}
Here we use System.out.println syntax to print our message in output.
we can also use -
System.out.printf
System.out.print
0 Comments
Post a Comment