Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 9th, 2020 195 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace NikiHomework
  8. {
  9.     class Program
  10.     {
  11.         public static void NumberToFind(int number, int[] array)
  12.         {
  13.             for (int i = 0; i < array.Length; i++)
  14.             {
  15.                 if (number == array[i])
  16.                 {
  17.                     Console.WriteLine($"My number is {array[i]}, with position {i + 1};");
  18.                     break;
  19.                 }
  20.             }
  21.         }
  22.  
  23.         static void Main(string[] args)
  24.         {
  25.             Console.WriteLine("Please enter your number:");
  26.             int number = int.Parse(Console.ReadLine());
  27.            
  28.             Console.WriteLine("Now enter your arrayLength:");
  29.             int arrayLength = int.Parse(Console.ReadLine());
  30.            
  31.             int[] array = new int[arrayLength];
  32.            
  33.             Console.WriteLine("Fill your array with numbers:");
  34.             for (int i = 0; i < arrayLength; i++)
  35.             {
  36.                 array[i] = int.Parse(Console.ReadLine());
  37.             }
  38.            
  39.             NumberToFind(number, array);
  40.            
  41.            
  42.            
  43.         }
  44.     }
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top