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 _1
- {
- class Program
- {
- static int PobierzLiczbe(string Nagłówek)
- {
- Console.Write(Nagłówek);
- int liczba = Convert.ToInt32(Console.ReadLine());
- return liczba;
- }
- static int[] tab = new int[PobierzLiczbe("Wprowadź ilość liczb,które chcesz wprowadzić ")];
- static int ZwróćMaksimum()
- {
- int maks = tab[0];
- for (int i = 0; i < tab.Length; i++) if (maks < tab[i]) maks = tab[i];
- return maks;
- }
- static int ZwróćMinimum()
- {
- int min = tab[0];
- for (int i = 0; i < tab.Length; i++) if (min > tab[i]) min = tab[i];
- return min;
- }
- static void Main(string[] args)
- {
- while (true)
- {
- int liczba = tab.Length;
- if (liczba == 0) break;
- for (int i = 0; i < tab.Length ; i++)
- {
- tab[i] = PobierzLiczbe("Wprowadź liczbę ");
- }
- Console.WriteLine("Maks = " + ZwróćMaksimum() + " min = " + ZwróćMinimum());
- Console.ReadKey();
- Console.Clear();
- tab = new int[PobierzLiczbe("Wprowadź ilość liczb,które chcesz wprowadzić ")];
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement