-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_1115(1).c
executable file
·62 lines (53 loc) · 969 Bytes
/
_1115(1).c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//#1151 Quadrant by Neilor Tonin
#include <stdio.h>
//Prototype of the function.
int quadrant(int, int);
int main ()
{
int x, y;
//Receving tests cases until one of them is equal to 0;
scanf ("%i %i", &x, &y);
int q;
do
{
q = quadrant(x, y);
if (q == 1)
{
printf ("primeiro\n");
}
else if (q == 2)
{
printf ("segundo\n");
}
else if (q == 3)
{
printf ("terceiro\n");
}
else
{
printf ("quarto\n");
}
scanf ("%i %i", &x, &y);
} while ((x != 0) && (y != 0));
return 0;
}
//Definition of the function.
int quadrant(int x, int y)
{
if ( (x > 0 ) && (y > 0) )
{
return 1;
}
else if ((x < 0) && (y > 0) )
{
return 2;
}
else if ( (x < 0) && (y < 0) )
{
return 3;
}
else
{
return 4;
}
}