Java Program for Consecutive Number and check Even Odd
import java.util.Scanner;
class Consecutive_Check
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter Number");
int n=sc.nextInt();
int ar[]=new int[5];
for(int x=n;x<n+5;x++)
{
ar[x-n]=x;
}
for(int x=0;x<5;x++)
{
int t = ar[x]%2;
switch(t)
{
case 0:
System.out.println(ar[x] + " Even");
break;
default:
System.out.println(ar[x] + " Odd");
break;
}
}
}
}
}

0 Comments
Please don't enter any spam link in comment box.
Emoji