Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- void main() {
- int l, c, a[10][10], i, j, k[20];
- printf("Number of lines: ");
- scanf_s("%d", &l);
- while (l > 10 || l < 1) {
- printf("Insert the number of lines(from 1 to 10): ");
- scanf_s("%d", &l);
- }
- printf("Number of columns: ");
- scanf_s("%d", &c);
- while (c > 10 | c < 1) {
- printf("Insert the number of columns(from 1 to 10): ");
- scanf_s("%d", &c);
- }
- for (i = 0; i < l; i++) {
- for (j = 0; j < c; j++) {
- printf("V[%d][%d]= ", i, j);
- scanf_s("%d", &a[i][j]);
- }
- }
- printf("The matrix is : \n");
- for(i = 0; i < l; i++) {
- for (j = 0; j < c; j++) {
- printf("%d ", a[i][j]);
- }
- printf("\n");
- }
- printf("For turninig the matrix into a vector, press any key.\n");
- _getch();
- printf("V=[");
- for (i = 0; i < l; i++) {
- for (j = 0; j < c; j++) {
- k[j] = a[i][j];
- printf("%d ", k[j]);
- }
- }
- printf("]\n");
- printf("\nPress any key to close the console.");
- _getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement