GVA SUPPORT

³äïîâ³äü íà çàïèòàííÿ ¹ 1296729668
Text:
	ԲΠ= Òû õòî?

 Çàïèòàííÿ:using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication10_knp
{
    class Program
    {
        static double f(double x)
        {
            double y;
            if (x <= 0)
            {
                y = -2 * x * x;
            }
            else
                if (x >= 1)
                {
                    y = (x - 1)*(x - 1);
                }
                else y=0;
            return y;
        }
        static void Main(string[] args)
        {
            int count = 1;
            for (double i = -2; i <= 2; i +=0.04)
            {
                Console.WriteLine("{0}\\\\t :  f({1}\\\\t) = {2}\\\\t",count++,i, f(i));
            }
            Console.ReadKey();
        }
    }
}


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


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

   class Program
    {
        static double f(double x)
        {
            double y;
            if (x <= 0)
            {
                y = -2 * x * x;
            }
            else
                if (x >= 1)
                {
                    y = (x - 1) * (x - 1);
                }
                else y = 0;
            return y;
        }
        static void Main(string[] args)
        {
            const int max = 100;
            double[] mas = new double[max];
            int count = 0;
            for (double i = -2; i <= 2; i += 0.04)
            {
                mas[count++] = f(i);
                Console.WriteLine("{0}\\t :  f({1}\\t) = {2}\\t", count, i,mas[count-1]);
            }
            Console.ReadKey();
        }
    }


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

	
Âàøà â³äïîâ³äü