Computer Science, asked by hassanzaib97pbno35, 11 months ago

write a java program that prompt the given given number is divisible by 3. show the message to the user if the number is divisible by 3​

Answers

Answered by sushiladevi4418
0

Answer:

Java program to check number is divisible by 3 or not.

Explanation:

public class divide {

   /**

    * @param args the command line arguments

    */

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter a number: ");

       int i = scan.nextInt();

   if (i % 3 == 0)

       {

           System.out.println( i + " is divisble by  3  ");

 }

else

           System.out.println(i + " is not divisble by  3  ");

   }

}

Similar questions