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 ConsoleApplication3
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random rnd = new Random();
- int[,] tab = new int[5, 4];
- for (int x = 0; x < 5; x++)
- {
- for (int y = 0; y < 4; y++)
- {
- if (y == 3)
- {
- tab[x, y] = ((tab[x, y - 3] + tab[x, y - 2]) * tab[x, y - 1]) / 2;
- }
- else
- {
- tab[x, y] = rnd.Next(1, 100);
- }
- }
- }
- for (int x = 0; x < 5; x++)
- {
- for (int y = 0; y < 2; y++)
- {
- Console.Write(tab[x, y] + " ");
- }
- Console.WriteLine();
- }
- Console.WriteLine();
- Console.WriteLine();
- Console.Write("Podaj pole: ");
- int zapytanie = Convert.ToInt32(Console.ReadLine());
- for (int x = 0; x < 5; x++)
- {
- if (zapytanie < tab[x, 3])
- Console.WriteLine("Pole trapezu(" + tab[x, 0] + "," + tab[x, 1] + "," + tab[x, 2] + ") = " + tab[x, 3]);
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement