LANGUAGE: Visual Basic
You are given an Integer variable k, an Integer array zipcodeList that has been declared and initialized, and a Boolean Variable duplicates. Write some code that assigns True to duplicates if there are two adjacent elements in the array that have the same value, and that assigns False to duplicates otherwise. Use only k, zipcodeList, and duplicates.
duplicates = false k = 0 Do If zipcodeList(k) = zipcodeList(k+1) Then duplicates = true End If k += 1 Loop Until (k = zipcodeList.length - 1)