Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Array Length is size of 1 to 100 Whole Numbers");
- Console.WriteLine("Please enter array size from 1 to 100");
- int arraySize = int.Parse(Console.ReadLine());
- int[] numberSet = new int[arraySize];
- bool contains = false;
- int count = 0;
- Console.WriteLine("Please enter a number between 1 to 100 and we'll tell you if it's inside the array");
- int theNumber = int.Parse(Console.ReadLine());
- for (int i = 0; i < arraySize; i++)
- {
- Console.WriteLine("Enter number: {0}", i + 1);
- int someNumber = int.Parse(Console.ReadLine());
- numberSet[i] = someNumber;
- contains = Work(numberSet[i]);
- if (numberSet[i] == theNumber)
- {
- count++;
- contains = true;
- }
- }
- if (numberSet.Length == arraySize)
- {
- Console.WriteLine("");
- Console.WriteLine(contains);
- Console.WriteLine(count);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment