using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Numsearch
{
class Program
{
static void Main(string[] args)
{
int[] a = new int[5];
int i,n;
for (i = 0; i < 5; i++)
{
Console.WriteLine("Enter number");
a[i] = Convert.ToInt32(Console.ReadLine());
}
Console.WriteLine("Enter number to search");
n = Convert.ToInt32(Console.ReadLine());
for (i = 0; i < 5; i++)
{
if (n == a[i])
{
Console.WriteLine("Number is found at "+i);
}
else
{
Console.WriteLine("Number is not found");
}
}
Console.ReadLine();
}
}
}
No comments:
Post a Comment