Ask Question
30 September, 18:49

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.

+3
Answers (1)
  1. 30 September, 19:15
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers