-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray Fill IV.cpp
More file actions
46 lines (43 loc) · 813 Bytes
/
Array Fill IV.cpp
File metadata and controls
46 lines (43 loc) · 813 Bytes
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
#include<bits/stdc++.h>
using namespace std;
void printodd(int arr[5],int x)
{
for(int i=0;i<x;i++)
{
printf("impar[%d] = %d\n",i,arr[i]);
}
}
void printeven(int arr[5],int x)
{
for(int i=0;i<x;i++)
{
printf("par[%d] = %d\n",i,arr[i]);
}
}
int main()
{
int oddar[5],evenarr[5],odd=0,even=0,a;
for(int i=0;i<15;i++)
{
cin >>a;
if(a%2==0)
{
if(even>=5){
printeven(evenarr,5);
even = 0;
}
evenarr[even] = a;
even+=1;
}
else{
if(odd>=5){
printodd(oddar,5);
odd=0;
}
oddar[odd] = a;
odd+=1;
}
}
printodd(oddar,odd);
printeven(evenarr,even);
}