DamSi

Untitled

Mar 8th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.64 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Lab1_5
  8. {
  9.     class Program
  10.     {
  11.         /*
  12.           ** author: Damjan Miloshevski
  13.           ** contact: [email protected];
  14.           ** skype: damjan.milosevski
  15.           ** phone: +38978566409;
  16.           ** web: https://www.facebook.com/damjan.miloshevski
  17.                   http://miloshevski.us.to/
  18.         */
  19.         static void Main(string[] args)
  20.         {
  21.             Console.Write("Kolku broevi kje vnesete? ");
  22.             int n = Convert.ToInt32(Console.ReadLine());
  23.             int min = int.MaxValue;
  24.             int max = int.MinValue;
  25.             double sum = 0;
  26.             double avg = 0;
  27.             Console.WriteLine();
  28.             Console.WriteLine("Vnesete gi broevite:");
  29.             Console.WriteLine();
  30.             for (int i = 1; i <= n; i++)
  31.             {
  32.                 Console.WriteLine("Broj {0}:", i);
  33.                 int broj = Convert.ToInt32(Console.ReadLine());
  34.                 if (broj > max)
  35.                 {
  36.                     max = broj;
  37.                 }
  38.                 if (broj < min)
  39.                 {
  40.                     min = broj;
  41.                 }
  42.                 sum += broj;
  43.                 avg = sum / n;
  44.             }
  45.             Console.WriteLine();
  46.             Console.WriteLine(string.Format("Suma = {0:#.##}, Prosek = {1:#.##} , Minimum = {2}, Maximum = {3}", sum, avg, min, max));
  47.             Console.WriteLine();
  48.             Console.WriteLine("Pritisnete bilo koe kopce za da izlezete.");
  49.             Console.ReadKey();
  50.         }
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment