Created
May 15, 2016 12:28
-
-
Save PaulChristmas/3ad9ef785352fc94e6d07e4224f6664a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
const m = 6; | |
const n = 8; | |
int main (void) { | |
int i, j, count = 0; | |
double A[m][n], B[m * n]; | |
for (i = 0; i < m; i++){ | |
for (j = 0; j < n; j++){ | |
printf ("\nA[%d][%d] = ", i, j); | |
scanf("%lf", &A[i][j]); | |
} | |
} | |
for (j = 0; j < n; j++){ | |
for (i = 0; i < m; i++){ | |
if (A[i][j] < 0){ | |
B[count] = A[i][j]; | |
count++; | |
} | |
} | |
} | |
printf ("%d elements found ", count); | |
if (count > 0){ | |
printf("B = ["); | |
for (i = 0; i < count - 1; i++){ | |
printf("%lf, ", B[i]); | |
} | |
printf("%lf]", B[count - 1]); | |
} | |
getch(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment