Why Choose Us?
0% AI Guarantee
Human-written only.
24/7 Support
Anytime, anywhere.
Plagiarism Free
100% Original.
Expert Tutors
Masters & PhDs.
100% Confidential
Your privacy matters.
On-Time Delivery
Never miss a deadline.
Write an algorithm in steps of this code
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");
}
}
}
Expert Solution
Need this Answer?
This solution is not in the archive yet. Hire an expert to solve it for you.





