MuffinMonster

Class Task 29#

Oct 30th, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.11 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             string family;
  13.             int num, min = 99999999, total = 0, sum = 0, zugi = 0, join,max = 0;
  14.             Console.WriteLine("Enter the amount of families joining the survey:");
  15.             join = int.Parse(Console.ReadLine());
  16.             for (int i = 0; i < join; i++)
  17.             {
  18.                 family = Console.ReadLine();
  19.                 num = int.Parse(Console.ReadLine());
  20.                 total++;
  21.                 max = Math.Max(max, num);
  22.                 if (max == num)
  23.                     Console.WriteLine(family);
  24.                 min = Math.Min(min, num);
  25.                 sum = sum + num;
  26.                 if (num % 2 == 0)
  27.                     zugi++;
  28.             }
  29.             Console.WriteLine("Minimum number: " + min);
  30.             Console.WriteLine((double)sum / total);
  31.             Console.WriteLine(zugi + " chose number zugi!");
  32.             Console.ReadLine();
  33.         }
  34.     }
  35. }
Add Comment
Please, Sign In to add comment