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;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Podaj rozmiar: ");
- string liczba = Console.ReadLine();
- int size = int.Parse(liczba);
- int[] tab = new int[10];
- for(int i=0;i<size;i++)
- {
- Console.WriteLine("Podaj liczbe: ");
- string numer = Console.ReadLine();
- int parsednumer = int.Parse(numer);
- tab[i] = parsednumer;
- }
- wlasciwosci(tab);
- void wlasciwosci(int[] tab)
- {
- Console.WriteLine("Suma: ");
- Console.WriteLine(sumaElementow(tab));
- int x = sumaElementow(tab);
- Console.WriteLine("Srednia: ");
- Console.WriteLine(srednia(size,x));
- Console.WriteLine("Minimum ");
- }
- int sumaElementow(int[] tab)
- {
- int sum = 0;
- for (int i = 0; i < size; i++)
- {
- sum += tab[i];
- }
- return sum;
- }
- float srednia(float size, float sum)
- {
- float avg = sum / size;
- return avg;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement