Last active
August 29, 2015 14:06
-
-
Save StaniTr/4eb5cc1718b73b6c398b to your computer and use it in GitHub Desktop.
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
import java.util.Scanner; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class Exam_Problem2_AddingAngles { | |
public static void main(String[] args) { | |
int count=0; | |
Scanner scanner = new Scanner(System.in); | |
int n = scanner.nextInt(); | |
scanner.nextLine(); | |
int[] nums = new int[n]; | |
for (int i = 0; i < nums.length; i++) { | |
nums[i] = scanner.nextInt(); | |
} | |
for (int x = 0; x < nums.length; x++) { | |
for (int y = x+1; y < nums.length; y++) { | |
for (int z = y+1; z < nums.length; z++) { | |
int checkSum=nums[x]+nums[y]+nums[z]; | |
if (checkSum%360==0) { | |
System.out.println(nums[x]+" + "+nums[y]+" + "+nums[z]+" = "+checkSum+ " degrees"); | |
count++; | |
} | |
} | |
} | |
} | |
//check if no | |
if (count==0) { | |
System.out.println("No"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment