Ask Question
30 January, 09:17

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.

+4
Answers (1)
  1. 30 January, 10:02
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers