Skip to content

Instantly share code, notes, and snippets.

@mherman22
Created August 19, 2021 08:29
Show Gist options
  • Save mherman22/c7c7cb0d9ae33f04be0e8d5668fca07d to your computer and use it in GitHub Desktop.
Save mherman22/c7c7cb0d9ae33f04be0e8d5668fca07d to your computer and use it in GitHub Desktop.
package myJourney;
import java.util.Scanner;
public class NumberElement {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter a Number : ");
int number = scanner.nextInt();
if (number % 5 == 0 && number % 3 == 0) {
System.out.println(number + " is divisible by both 5 and 3 ");
}else if (number % 3 == 0) {
System.out.println(number + " is divisible by 4");
}else if (number % 5 == 0 ) {
System.out.println(number + " is divisible by 5");
}else
System.out.println(number);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment