import java.util.Scanner; public class BooleanExpression2 { public static void main(String[] args) { /*Question 3. Write a program that prompts the user to enter an integer. If the number is a multiple of 5, the program displays HiFive. If the number is divisible by 2, it displays HiEven. */ Scanner scanner = new Scanner(System.in); System.out.println("Please Enter a number:"); int number = scanner.nextInt(); if(number % 2 == 0) { System.out.println("Hi Even "); } else if( number % 5 == 0) { System.out.println("Hi Five: "); } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter