Last active
February 15, 2019 08:42
-
-
Save karellism/cd25d9a3d8c229e0e741b39abd172384 to your computer and use it in GitHub Desktop.
TRUE or FALSE is Divisible by 7?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
* | |
* Reads in two integer command-line arguments x and y and prints "true" | |
* if both are divisible by 7, and false otherwise. | |
* | |
* a % 7 is the remainder when you divide 7 into a. If the remainder | |
* is 0, then a is divisible by 7. | |
* | |
******************************************************************************/ | |
public class Divisibility { | |
public static void main(String[] args) { | |
int x = Integer.parseInt(args[0]); | |
int y = Integer.parseInt(args[1]); | |
boolean isDivisible = (x % 7 == 0) && (y % 7 == 0); | |
System.out.println(isDivisible); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment