Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main() {
- int n, m;
- scanf("%d%d", &n, &m);
- int A[n][m];
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < m; j++) {
- scanf("%d", &A[i][j]);
- }
- }
- int podredena_A[n][m];
- for(int i = 0; i < n; i++) {
- int cj = 0;
- for(int j = 0; j < m; j++) {
- if(A[i][j] % 2 == 0) {
- podredena_A[i][cj] = A[i][j];
- cj++;
- }
- }
- for(int j = 0; j < m; j++) {
- if(A[i][j] % 2 == 1) {
- podredena_A[i][cj] = A[i][j];
- cj++;
- }
- }
- }
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < m; j++) {
- printf("%d ", podredena_A[i][j]);
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment