Guest User

Untitled

a guest
Feb 24th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. public bool numberequal(int sum, int[] array)
  2.  
  3. {
  4.  
  5. int i, k, j;
  6. bool answer = false;
  7.  
  8. for (i = 0; i < array.Length - 2; i++)
  9. {
  10. for (k = i + 1; k < array.Length - 1; k++)
  11. {
  12. for (j = k + 1; j < array.Length; j++)
  13. {
  14. if (array[i] + array[k] + array[j] == sum)
  15. {
  16. answer = true;
  17. return true;
  18. }
  19. }
  20. }
  21. }
  22.  
  23. return answer;
  24. }
Add Comment
Please, Sign In to add comment