
Untitled
By: a guest on
May 24th, 2012 | syntax:
C# | size: 1.29 KB | hits: 15 | expires: Never
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double x, y=0;
string str;
char rep=' ';
do
{ Console.Clear();
Console.Write("введите значение x: ");
str=Console.ReadLine();
x=double.Parse(str);
if (x<=-2|| x>=2)
y=0;
if(x<=1 && x>=-1) y=-1;
if (x>1 && x<2) y=x-2;
if (x<-1 && x >-2) y=-x-2;
Console.Write("значение x="+x.ToString());
Console.Write("значение y="+y.ToString()); y
Console.Write("для повотора нажать y");
rep=char.Parse(Console.ReadLine());}
while(rep=='Y'||rep=='y');
}
}
}