32 lines
646 B
C#
32 lines
646 B
C#
|
using System;
|
||
|
|
||
|
namespace exercicios
|
||
|
{
|
||
|
public class Exercicio7
|
||
|
{
|
||
|
public static void Init()
|
||
|
{
|
||
|
float x,y;
|
||
|
Console.WriteLine("Write the values for X and Y");
|
||
|
x = float.Parse(Console.ReadLine());
|
||
|
y = float.Parse(Console.ReadLine());
|
||
|
Console.WriteLine("(x{0:N2};y{1:N2}) is in quadrant {2}",
|
||
|
x,y,verificaQuadrante(x,y));
|
||
|
}
|
||
|
static char verificaQuadrante(float x, float y)
|
||
|
{
|
||
|
if (x > 0)
|
||
|
{
|
||
|
if(y >= 0)return '1';
|
||
|
else if(y < 0)return '4';
|
||
|
}
|
||
|
else if (x < 0)
|
||
|
{
|
||
|
if(y >= 0)return '2';
|
||
|
else if(y < 0)return '3';
|
||
|
}
|
||
|
return 'N';
|
||
|
}
|
||
|
}
|
||
|
}
|