Created
March 28, 2015 12:12
-
-
Save Kanol/320ecc78919c1931193a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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