Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Kanol/320ecc78919c1931193a to your computer and use it in GitHub Desktop.
Save Kanol/320ecc78919c1931193a to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Среднее_арифметическое
{
class Program
{
static void Main(string[] args)
{
Console.Write("Введите количество чисел:");
Int32 Count = Convert.ToInt32(Console.ReadLine()), Amount = 0, Sum = 0, MidAr, Count2 = 0;
Int32[] Array = new Int32[Count];
Console.Clear();
while(Count!=Count2)
{
Console.WriteLine("Введите число");
Array[Count2] = Convert.ToInt32(Console.ReadLine());
if (Array[Count2]!=0)
{
Amount++;
Sum = Sum + Array[Count2];
}
Count2++;
Console.Clear();
}
MidAr = Sum / Amount;
Console.Write("Среднее арифметическое этих чисел, исключая 0 равно ");
Console.Write(MidAr);
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment