#include <stdio.h>
#define MAXIMUM 100
int main(){
int arr[MAXIMUM][MAXIMUM];
int otv[MAXIMUM][MAXIMUM];
int n, m, k, count, all_even, new_row, index;
int i, j;
printf("enter height and lenght: ");
/*Input of elements of the start array*/
for (i = 0; i < n; i++) {
printf("enter %d elements of the %d of %d lines: ", m
, i
+1, n
); index = 0;
all_even = 1;
while (all_even
== 1 && index
< m
&& scanf("%d", &k
) == 1) { arr[i][index] = k;
index++;
if (k < 0){
all_even = 0;
}
}
}
/*Determining the size of a final array*/
count = 0;
for (i = 0; i < n; i++) {
all_even = 1;
for (j = 0; j < m; j++) {
if (arr[i][j] % 2 != 0) {
all_even = 0;
}
}
if (all_even) {
count++;
}
}
/*Enter final array*/
new_row = 0;
for (i = 0; i < n; i++) {
all_even = 1;
for (j = 0; j < m; j++) {
if (arr[i][j] % 2 != 0) {
all_even = 0;
}
}
if (all_even) {
for (j = 0; j < m; j++) {
otv[j][new_row] = arr[i][j];
}
new_row++;
}
}
/*Output start array*/
for (i = 0; i < n; i++) {
for (j = 0; j < m; j++) {
}
}
/*Output final array*/
for (i = 0; i < m; i++) {
for (j = 0; j < count; j++) {
}
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNkZWZpbmUgTUFYSU1VTSAxMDAKaW50IG1haW4oKXsKICAgIGludCBhcnJbTUFYSU1VTV1bTUFYSU1VTV07CiAgICBpbnQgb3R2W01BWElNVU1dW01BWElNVU1dOwogICAgaW50IG4sIG0sIGssIGNvdW50LCBhbGxfZXZlbiwgbmV3X3JvdywgaW5kZXg7CiAgICBpbnQgaSwgajsKCiAgICBwcmludGYoImVudGVyIGhlaWdodCBhbmQgbGVuZ2h0OiAiKTsKICAgIHNjYW5mKCIlaSAlaSIsICZuLCAmbSk7CgogICAgLypJbnB1dCBvZiBlbGVtZW50cyBvZiB0aGUgc3RhcnQgYXJyYXkqLwogICAgZm9yIChpID0gMDsgaSA8IG47IGkrKykgewogICAgICBwcmludGYoImVudGVyICVkIGVsZW1lbnRzIG9mIHRoZSAlZCBvZiAlZCBsaW5lczogIiwgbSwgaSsxLCBuKTsKICAgICAgaW5kZXggPSAwOwogICAgICBhbGxfZXZlbiA9IDE7CiAgICAgIHdoaWxlIChhbGxfZXZlbiA9PSAxICYmIGluZGV4IDwgbSAmJiBzY2FuZigiJWQiLCAmaykgPT0gMSkgewogICAgICAgIGFycltpXVtpbmRleF0gPSBrOwogICAgICAgIGluZGV4Kys7CiAgICAgICAgaWYgKGsgPCAwKXsKICAgICAgICAgIGFsbF9ldmVuID0gMDsKICAgICAgICB9CiAgICAgIH0KICAgIH0KCiAgICBwcmludGYoIlxuIik7CgogICAgLypEZXRlcm1pbmluZyB0aGUgc2l6ZSBvZiBhIGZpbmFsIGFycmF5Ki8KICAgIGNvdW50ID0gMDsKICAgIGZvciAoaSA9IDA7IGkgPCBuOyBpKyspIHsKICAgICAgYWxsX2V2ZW4gPSAxOwogICAgICBmb3IgKGogPSAwOyBqIDwgbTsgaisrKSB7CiAgICAgICAgaWYgKGFycltpXVtqXSAlIDIgIT0gMCkgewogICAgICAgICAgYWxsX2V2ZW4gPSAwOwogICAgICAgIH0KICAgICAgfQogICAgICBpZiAoYWxsX2V2ZW4pIHsKICAgICAgICBjb3VudCsrOwogICAgICB9CiAgICB9CgogIC8qRW50ZXIgZmluYWwgYXJyYXkqLwogIG5ld19yb3cgPSAwOwogIGZvciAoaSA9IDA7IGkgPCBuOyBpKyspIHsKICAgIGFsbF9ldmVuID0gMTsKICAgIGZvciAoaiA9IDA7IGogPCBtOyBqKyspIHsKICAgICAgaWYgKGFycltpXVtqXSAlIDIgIT0gMCkgewogICAgICAgIGFsbF9ldmVuID0gMDsKICAgICAgfQogICAgfQogICAgaWYgKGFsbF9ldmVuKSB7CiAgICAgIGZvciAoaiA9IDA7IGogPCBtOyBqKyspIHsKICAgICAgICBvdHZbal1bbmV3X3Jvd10gPSBhcnJbaV1bal07CiAgICAgIH0KICAgICAgbmV3X3JvdysrOwogICAgfQogIH0KCiAgLypPdXRwdXQgc3RhcnQgYXJyYXkqLwogIHByaW50Zigic3RhcnQgYXJyYXk6XG4iKTsKICBmb3IgKGkgPSAwOyBpIDwgbjsgaSsrKSB7CiAgICBmb3IgKGogPSAwOyBqIDwgbTsgaisrKSB7CiAgICAgIHByaW50ZigiJWQgIiwgYXJyW2ldW2pdKTsKICAgIH0KICAgIHByaW50ZigiXG4iKTsKICB9CgogIHByaW50ZigiXG4iKTsKCiAgLypPdXRwdXQgZmluYWwgYXJyYXkqLwogIHByaW50ZigiZmluYWwgYXJyYXk6XG4iKTsKICBmb3IgKGkgPSAwOyBpIDwgbTsgaSsrKSB7CiAgICBmb3IgKGogPSAwOyBqIDwgY291bnQ7IGorKykgewogICAgICBwcmludGYoIiVkICIsIG90dltpXVtqXSk7CiAgICB9CiAgICBwcmludGYoIlxuIik7CiAgfQogICAgcmV0dXJuIDA7Cn0=