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