Advertisement
Benya365

"Average Value for CIS education documents" program

Jan 31st, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.60 KB | None | 0 0
  1. using System;
  2.  
  3. class program
  4. {
  5.     public static void Main()
  6.     {
  7.         int n;
  8.         double average = 0, sum = 0;
  9.         Console.Write("Введите количество оценок:\t");
  10.         n = Convert.ToInt32(Console.ReadLine());
  11.         int[] a = new int[n];
  12.         for (int i = 0; i < n; i++)
  13.         {
  14.             Console.Write("Оценка №{0}:\t", i + 1);
  15.             a[i] = Convert.ToInt32(Console.ReadLine());
  16.             sum += a[i];
  17.         }
  18.         average = sum / n;
  19.         Console.Write("\nСреднее:\t{0:f1}", average);
  20.         Console.ReadKey();
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement