Ask Question
13 August, 01:21

You are given two int variables j and k, an int array zipcodelist that has been declared and initialized, and an boolean variable duplicates. write some code that assigns true to duplicates if any two elements in the array have the same value, and that assigns false to duplicates otherwise. use only j, k, zipcodelist, and duplicates.

+2
Answers (1)
  1. 13 August, 03:58
    0
    Duplicates = false;

    for (j = 0; j < zipcodelist. length - 1; j++)

    {

    for (k = j + 1; k < zipcodelist. length; k++)

    {

    if (zipcodelist[ j ] = = zipcodelist[ k ])

    {

    duplicates = true;

    break;

    }

    }

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “You are given two int variables j and k, an int array zipcodelist that has been declared and initialized, and an boolean variable ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers