GVA SUPPORT

Відповідь на запитання № 1295593667
Text:
	ФІО = Бунтов Пилип 

 Запитання:реалізувати метод, який підраховує сумувідємнихелементівзаданого дійсного масиву 


====================================


 ANSWER ====================================

А как масив задается? Это в консоли?


 END of ANSWER ====================================



 ANSWER ====================================

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
const int max=4;
double [] mas = new double [max];

for (int i = 0; i < max; i++)
{
    mas[i]=Convert.ToDouble( Console.ReadLine());
}

double sum = 0;
for (int i = 0; i < max; i++)
{
    if (mas[i] < 0) { sum += mas[i]; }
}
Console.WriteLine("Sum = {0}",sum);
Console.ReadKey();
        }
    }
}



 END of ANSWER ====================================



 ANSWER ====================================

Б2 я не вижу на форуме....


 END of ANSWER ====================================



 ANSWER ====================================

У меня щитает правильно 
проверяй )


 END of ANSWER ====================================



 ANSWER ====================================

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication11
{
    class Program
    {
        const int max = 4;
        static double[] mas = new double[max];
        static void zap_mas1()
        {

            Console.WriteLine("Vvedite elementi masiva :");
            for (int i = 0; i < max; i++)
            {
                Console.Write("[{0}] = ", i);
                mas[i] = Convert.ToDouble(Console.ReadLine());
            }
            
        }
        static double result1()
        {
            double sum = 0;
            for (int i = 0; i < max; i++)
            {
                Console.WriteLine("-> {0}",mas[i]);
                if (mas[i] < 0) { sum += mas[i]; }
            }
            return sum;
        }
        static void Main(string[] args)
        {
            zap_mas1();
       
            double rez = result1();
            Console.WriteLine("Sum videmnix elementiv masiva = {0}", rez);
            Console.ReadKey();
        }
    }
}



 END of ANSWER ====================================



 ANSWER ====================================

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication11
{
    class Program
    {
        const int max = 4;
        static double[] mas = new double[max];
        static void zap_mas1()
        {

            Console.WriteLine("Vvedite elementi masiva :");
            for (int i = 0; i < max; i++)
            {
                Console.Write("[{0}] = ", i);
                mas[i] = Convert.ToDouble(Console.ReadLine());
            }
            
        }
        static double result1()
        {
            double sum = 0;
            for (int i = 0; i < max; i++)
            {
                Console.WriteLine("-> {0}",mas[i]);
                if (mas[i] < 0) { sum += mas[i]; }
            }
            return sum;
        }
        static void Main(string[] args)
        {
            zap_mas1();
       
            double rez = result1();
            Console.WriteLine("Sum videmnix elementiv masiva = {0}", rez);
            Console.ReadKey();
        }
    }
}



 END of ANSWER ====================================

	
Ваша відповідь