Write a program to input any number to check if it is odd and divisible by 9
Answers
Answered by
0
Answer:
9, 198 , 171, 9990 , 3411 ,
Explanation:
these numbers are divisble by 9.
Answered by
1
Answer:
import java.util.*;
public class Divisibility
{
public static void main(String args[ ])
{
Scanner in=new Scanner(System.in);
int a;
System.out.println("Enter the number");
a=in.nextInt();
if(a%2!=0&&a%9==0)
{
System.out.println("The number is odd and divisible by 9");
}
else if(a%2==0&&a%9==0)
{
System.out.println("The number is not odd but divisible by 9");
}
else if(a%2!=0&&a%9!=0)
{
System.out.println("The number is odd but not divisible by 9");
}
else if(a%2==0&&a%9!=0)
{
System.out.println("The number is neither odd nor divisible by 9");
}
}
}
Similar questions