using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ArrayElementPresent
{
class Program
{
static void Main(string[] args)
{
int[] a1 = new int[] { 10, 20, 30, 40, 50 };
int i, b, pos;
for (i = 0; i < 5; i++)
Console.WriteLine(a1[i]);
Console.WriteLine("Enter Element: ");
b = Convert.ToInt32(Console.ReadLine());
for (i = 0; i < 5; i++)
if (a1[i] == b)
Console.WriteLine("Element Present");
Console.ReadLine();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ArrayElementPresent
{
class Program
{
static void Main(string[] args)
{
int[] a1 = new int[] { 10, 20, 30, 40, 50 };
int i, b, pos;
for (i = 0; i < 5; i++)
Console.WriteLine(a1[i]);
Console.WriteLine("Enter Element: ");
b = Convert.ToInt32(Console.ReadLine());
for (i = 0; i < 5; i++)
if (a1[i] == b)
Console.WriteLine("Element Present");
Console.ReadLine();
}
}
}
Output:
No comments:
Post a Comment