Computer Science, asked by thilak9, 8 months ago


write a program in java to check the number between A and B, using it....else statement​

Answers

Answered by sherlock611holmes
1

Answer:

let us check whether the numbers between A and B are odd or even.

import java.util.*;

class number

{

   public static void main()

   {

   Scanner sc=new Scanner(System.in);

   System.out.println("Enter the limits A and B: ");

   int A=sc.nextInt();

   int B=sc.nextInt();

   for(int i=A; i<=B;i++)

   {

   if(i%2==0)

   System.out.println(i+" is an even number");

   else

   System.out.println(i+" is an odd number");

   }

   }

}

Similar questions