Created
October 9, 2015 10:48
-
-
Save zaur/6bda831b68fb2a192dc3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public class Main { | |
public static void main(String[] args) { | |
int sum = 151; | |
int max3 = sum / 3; | |
for (int i = 0; i <= max3; i++) { | |
int s1 = sum - 3 * i; | |
int max5 = s1 / 5; | |
for (int j = 0; j <= max5; j++) { | |
int s2 = s1 - 5 * j; | |
if (s2 % 7 == 0) { | |
int num7 = s2 / 7; | |
System.out.println("3 - " + i + "; 5 - " + j + "; 7 - " + num7); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment