check whether the number is even or odd
import java.util.Scanner;
public class Odd_Even
{
public static void main(String[] args)
{
int n;
Scanner s = new Scanner(System.in);
System.out.print("Enter the number you want to check:");
n = s.nextInt();
if(n % 2 == 0)
{
System.out.println("The given number "+n+" is Even ");
}
else
{
System.out.println("The given number "+n+" is Odd ");
}
}
}
public class Odd_Even
{
public static void main(String[] args)
{
int n;
Scanner s = new Scanner(System.in);
System.out.print("Enter the number you want to check:");
n = s.nextInt();
if(n % 2 == 0)
{
System.out.println("The given number "+n+" is Even ");
}
else
{
System.out.println("The given number "+n+" is Odd ");
}
}
}
Sir can I give me output of the program
ReplyDelete44
DeleteThe given number is 44 is even
13
The given number is 13 is odd
sir check whether the number is even or odd ane program lo 8th line lo print ani icharu kada akkada println ani vundadha
ReplyDeletePrint ln : It adds new line after the message gets dispalyed.
ReplyDeleteprint : It does not add any new line.