C# Saved Program: majestic-mountain

facebook share

Here's the online compiler accompanied with IDE at your service. This is a saved code by one of our users. Try it out or save your own from the IDE page and don't forget to leave a feedback. You can find that at the bottom of the page.


using System;
using System.Collections.Generic;
using System.IO;
class Solution {
    static void Main(String[] args) {
        int n = Convert.ToInt32(Console.ReadLine());
        String[] tokens_x = Console.ReadLine().Split(' ');
        int sum = 0;
        for (int i= 0; i < n; i++)
        {
            sum = sum +  Convert.ToInt32(tokens_x[i]);
        }        
        double avg = sum / n;
        Console.WriteLine(avg);

    }
}
Execute

Output

Press the execute button or CTRL + enter to run code.

Inputs