Advertisement
FiddleComputers

Coding interview 1 - C function

Oct 17th, 2020 (edited)
1,143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.20 KB | None | 0 0
  1. int addUp(int* array, int arraySize, int k)
  2. {
  3.     for(int i = 0; i < arraySize; i++)
  4.     {
  5.         for(int j = i + 1; j < arraySize; j++)
  6.         {
  7.             if(array[i] + array[j] == k) return 1;
  8.         }
  9.     }
  10.  
  11.     return false;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement