Skip to content

Commit

Permalink
Create Q4.c
Browse files Browse the repository at this point in the history
  • Loading branch information
emrebil authored Dec 7, 2019
1 parent 12b1204 commit 310c058
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions W11/Q4.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <stdio.h>
#include <stdlib.h>

void func(int n, int m, int numbers[n][m], int a, int b) {
int j;
for(j = 0; j < m; j ++) {
int temp = numbers[a][j];
numbers[a][j] = numbers[b][j];
numbers[b][j] = temp;
}
}

int main(void) {
int n, m, a, b;
scanf ("%i %i %i %i", &n, &m, &a, &b);
int i, j;

int numbers[n][m];
for(i = 0; i < n; i ++) {
for(j = 0; j < m; j ++) {
scanf("%i", &numbers[i][j]);
}
}

func(n, m, numbers, a, b);

for(i = 0; i < n; i ++) {
for(j = 0; j < m; j ++) {
printf("%i ", numbers[i][j]);
}
printf("\n");
}
return 0;
}

0 comments on commit 310c058

Please sign in to comment.