Информатика, вопрос задал Аноним , 6 лет назад

СДЕЛАТЬ НА C#
пж пж пж​

Приложения:

Ответы на вопрос

Ответил orakul96
1

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace AutoIT //Это моё название проекта

                                //Ты при  создании можешь назвать как хочешь

{

   internal class Program

   {

       

       static int Sum(int end, int[] A)

       {

           int sum = 0;

           if(end > 0)

           {

              for (int i = 0; i <= end; i++)

              {

                 sum+=A[i];

              }

               return sum;

           }

           else

           {

               return A[0];

           }

       }

       static void Main(string[] args)

       {

           Console.OutputEncoding = Encoding.UTF8;

           int N = int.Parse(Console.ReadLine());

           int[] A = new int[N];

           double[] B = new double[N];

           for (int i = 0; i < A.Length; i++)

           {

               A[i] = int.Parse(Console.ReadLine());

           }

           for(int i = 0; i < A.Length; i++)

           {

               Console.Write(A[i] + " ");

           }

           Console.WriteLine();

           for (int i = 0; i < B.Length; i++)

           {

               int a = i + 1;

               B[i] = (double)Sum(i, A) / a;

           }

           for (int i = 0; i < B.Length; i++)

           {

               Console.Write(B[i] + " ");

           }

           Console.ReadLine();

           

       }

   }

}

Новые вопросы
Алгебра, 8 лет назад