Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public bool numberequal(int sum, int[] array)
- {
- int i, k, j;
- bool answer = false;
- for (i = 0; i < array.Length - 2; i++)
- {
- for (k = i + 1; k < array.Length - 1; k++)
- {
- for (j = k + 1; j < array.Length; j++)
- {
- if (array[i] + array[k] + array[j] == sum)
- {
- answer = true;
- return true;
- }
- }
- }
- }
- return answer;
- }
Add Comment
Please, Sign In to add comment