Write a program to take a number from the user and Check if it is divided by 9 and 5
Answers
Answered by
1
Answer:
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter a number:");
int num = sc.nextInt();
if(num%5 == 0 && num%9 == 0){
System.out.println(num + " is divisible by 9 and 5");
}
else{
System.out.println(num + " is divisible by both 9 and 5");
}
}
}
Explanation:
Similar questions