Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Write an algorithm in steps of this code

Write an algorithm in steps of this code

Computer Science

Write an algorithm in steps of this code.
? draw flowchart 

and write analysis :

package firstApplication;

import java.util.Scanner; //imports scanner class

public class DivisibleBy5And6 {

   public static void main(String[] args) {

       Scanner input = new Scanner(System.in); //creates a scanner object
       System.out.print("Enter an integer: "); //prompts user to enter an integer
       int integer = input.nextInt(); //assigns user input to integer variable

       if (integer % 5 == 0 && integer % 6 == 0) { //if integer is divisible by 5 and 6
           System.out.println("Is " + integer + " divisible by 5 and 6? true");
       } else {
           System.out.println("Is " + integer + " divisible by 5 and 6? false");
       }

       if (integer % 5 == 0 || integer % 6 == 0) { //if integer is divisible by 5 or 6
           System.out.println("Is " + integer + " divisible by 5 or 6? true");
       } else {
           System.out.println("Is " + integer + " divisible by 5 or 6? false");
       }

       if ((integer % 5 == 0 && integer % 6 != 0) || (integer % 5 != 0 && integer % 6 == 0)) { //if integer is divisible by 5 or 6 but not both
           System.out.println("Is " + integer + " divisible by 5 or 6, but not both? true");
       } else {
           System.out.println("Is " + integer + " divisible by 5 or 6, but not both? false");
       }
   }
}

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE