Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace example 2
- class Program
- {
- static void Main(string[] args)
- {
- Random b = new Random();
- int[] Arr1 = new int[5];
- int[] Arr2 = new int[5];
- bool[] CompareArr = new bool[5];
- for (int i = 0; i < 5; i++)
- {
- Console.WriteLine("pick a number between 10 to 20");
- Console.WriteLine("Try number: {0}", i + 1);
- int number = Convert.ToInt32(Console.ReadLine());
- if (number >= 10 & number <= 20)
- {
- Arr1[i] = number;
- }
- else
- {
- Console.WriteLine("Try again!");
- i = i - 1;
- }
- int a = b.Next(10, 20);
- Arr2[i] = a;
- if (Arr1[i] < Arr2[i])
- {
- CompareArr[i] = true;
- }
- else
- {
- CompareArr[i] = false;
- }
- }
- Console.WriteLine("{0} {1} {2} {3} {4}", Arr2[0], Arr2[1], Arr2[2], Arr2[3], Arr2[4]);
- Console.WriteLine("{0} {1} {2} {3} {4}", CompareArr[0], CompareArr[1], CompareArr[2], CompareArr[3], CompareArr[4]);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement