Check zip code
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
namespace CheckZipCode
{
public class Program
{
public static void Main()
{
//Initializing
int[] zipCodes = { 54570, 52250, 74000, 47040 }; //Enter more zip codes here
bool found = false;
//Taking input
Console.WriteLine("Enter 5 digit zip code");
int userZip = int.Parse(Console.ReadLine());
//Checking zip code
for (int i = 0; i < zipCodes.Length; i++)
{
if (userZip == zipCodes[i])
{
found = true;
break;
}
}
//printing output
if (found == true)
{
Console.WriteLine("Zip code found");
}
else
{
Console.WriteLine("Zip code not found");
}
}
}
}
Comments
Post a Comment