write a program in java to check the number between A and B, using it....else statement
Answers
Answered by
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
Physics,
5 months ago
Social Sciences,
5 months ago
Physics,
5 months ago
Chemistry,
9 months ago
Math,
9 months ago