.
if (1) 1;
if (2) 2;
else 3;
Else 4;
, , .. 1.
. , . :
if (1) 1;
if (2) 2;
else 4;
1 2.
: Sin(x)>=0 Sin(x)<2.5. .
......
double x=1.0; bool f; //
f = (Math.Sin(x) >= 0) && (Math.Sin(x) < 2.5); // && - //
Console.WriteLine(" :");
if (f)
Console.WriteLine(" True x {0,5:f2} {1,7:f3} {2}", x, Math.Sin(x), f);
else
Console.WriteLine(" False x {0,5:f2} {1,7:f3} {2}", x, Math.Sin(x), f);
, . , . Math. : Math.Sin(x)
G=F(X,Y)
| true, (X,Y)
G = <
| false, (X,Y)
- R 270<= fi <=45
using System; //
class Operator
{
public static void Main()
{const double R = 2.8; //
double x, y; //
bool g; //
char rep; //
string str; //
Console.Clear(); //
Console.Write(" X: "); //
str = Console.ReadLine(); //
x = double.Parse(str); //
Console.Write(" Y: ");
str = Console.ReadLine();
y = double.Parse(str);
if (x * x + y * y <= R * R) //
if (x >= 0) // Y
if (y <= x) // y = x
g = true; //
else // y = x
g = false; //
else // Y
g = false; //
else //
g = false; //
str = string.Format("G({0:f3},{1:f3}) = {2}", x, y, g);
Console.WriteLine(str);
} //
} //
|
|
. , ? , . , , . : : , , , .
, , r R. x y : (x2+y2>r2) (x2+y2<R2)
, , . , .
double x, y;
double r = 1.0, R = 3.0;
Console.WriteLine(" : ");
Console.WriteLine(" (x,y): ");
x = double.Parse(Console.ReadLine());
y = double.Parse(Console.ReadLine());
if (((x*x+y*y)>r*r) && ((x*x+y*y)<R*R))
Console.WriteLine("YES {0} {1}",x,y);
Else
Console.WriteLine(" NO {0} {1}",x,y);