-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBC1179.cpp
More file actions
44 lines (41 loc) · 1.06 KB
/
BC1179.cpp
File metadata and controls
44 lines (41 loc) · 1.06 KB
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
#include <iostream>
using namespace std;
int main()
{
int par[5] = {0}, impar[5] = {0};
int contPar = 0, contImpar = 0, num;
for (int i = 0; i <= 15; i++)
{
if (i < 15)
cin >> num;
if (i == 15)
{
for (int j = 0; j < contImpar; j++)
cout << "impar[" << j << "] = " << impar[j] << endl;
for (int j = 0; j < contPar; j++)
cout << "par[" << j << "] = " << par[j] << endl;
break;
}
if (num % 2 == 0)
{
par[contPar++] = num;
if (contPar == 5)
{
for (int j = 0; j < 5; j++)
cout << "par[" << j << "] = " << par[j] << endl;
contPar = 0;
}
}
else
{
impar[contImpar++] = num;
if (contImpar == 5)
{
for (int j = 0; j < 5; j++)
cout << "impar[" << j << "] = " << impar[j] << endl;
contImpar = 0;
}
}
}
return 0;
}