Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Combinations {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int num = Integer.parseInt(scanner.next()),
- counter = 0;
- for (int a = 0; a <= num; a++) {
- for (int b = 0; b <= num; b++) {
- for (int c = 0; c <= num; c++) {
- if (a + b + c == num) {
- counter++;
- }
- }
- }
- }
- System.out.println(counter);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement