Text: |
ԲΠ= Òû õòî?
Çàïèòàííÿ:Îòâåò:
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();
}
}
====================================
|