So I am trying to solve this, but even if user enters zipCode that is not in array the program still says Console.WriteLine("We deliver there it will cost you {0}", answerPrice);..........................
I dont get it, i looked at and looked and just cant find the problem
int[] ZipCode = { 28303, 12526, 72334, 17811, 86251, 56214, 72334, 87243, 71422, 72343 };
double[] prices = { 0.10, 2.0, .50, .25, .15, .75, 1.0, 7.0, 15.0, 5.0 };
double answerPrice = 0;
bool Found = true;
Console.WriteLine("Enter the zip:");
string readLine = Console.ReadLine();
int userInput = Convert.ToInt32(readLine);
for (int index = 0; index < ZipCode.Length; ++index)
{
if (userInput == ZipCode[index])
{
Found = true;
answerPrice = prices[index];
}
}
if(Found)
Console.WriteLine("We deliver there it will cost you {0}", answerPrice);
else
Console.WriteLine("Sorry we don't deliver it");
Going over array
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Prime bRank #2,035 · 712 reputationPosted Jan 19, 2012, 1:42 PM EST
Jignesh TrivediRank #16 · 50.3K reputationPosted Jan 19, 2012, 5:50 PM EST
you find ans. for your post is good..
ihave some suggetion on above screen.
try to use generic list instred of array.
try to Linq to find out value from generic list.
because its good practice.