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 Lab1_5
- {
- class Program
- {
- /*
- ** author: Damjan Miloshevski
- ** contact: [email protected];
- ** skype: damjan.milosevski
- ** phone: +38978566409;
- ** web: https://www.facebook.com/damjan.miloshevski
- http://miloshevski.us.to/
- */
- static void Main(string[] args)
- {
- Console.Write("Kolku broevi kje vnesete? ");
- int n = Convert.ToInt32(Console.ReadLine());
- int min = int.MaxValue;
- int max = int.MinValue;
- double sum = 0;
- double avg = 0;
- Console.WriteLine();
- Console.WriteLine("Vnesete gi broevite:");
- Console.WriteLine();
- for (int i = 1; i <= n; i++)
- {
- Console.WriteLine("Broj {0}:", i);
- int broj = Convert.ToInt32(Console.ReadLine());
- if (broj > max)
- {
- max = broj;
- }
- if (broj < min)
- {
- min = broj;
- }
- sum += broj;
- avg = sum / n;
- }
- Console.WriteLine();
- Console.WriteLine(string.Format("Suma = {0:#.##}, Prosek = {1:#.##} , Minimum = {2}, Maximum = {3}", sum, avg, min, max));
- Console.WriteLine();
- Console.WriteLine("Pritisnete bilo koe kopce za da izlezete.");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment