first commit
This commit is contained in:
31
listas3/source/exercicio7.cs
Normal file
31
listas3/source/exercicio7.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
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';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user