Created
October 30, 2023 07:36
-
-
Save wpsadi/02e79ff545af232bea6eaba757666bcd to your computer and use it in GitHub Desktop.
Write a Program in C language that takes value to create a matrix, but firstly it should ask for the order of the matrix
This file contains hidden or 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> | |
| int main(){ | |
| printf("To Create a Matrix, We Would need you to Enter these details ;"); | |
| printf("\n\n"); | |
| printf("How many Rows will be in your matrix : "); | |
| int row; | |
| scanf("%d",&row); | |
| printf("\n"); | |
| printf("How many Columns will be in your matrix : "); | |
| int col; | |
| scanf("%d",&col); | |
| printf("\n"); | |
| printf("\nYou want to create a matrix of order %d x %d",row,col); | |
| printf("\n\n"); | |
| for (int i = 1; i<=row; i++){ | |
| for (int j = 1; j<=col; j++){ | |
| printf("\t%d%d",i,j); | |
| } | |
| printf("\n"); | |
| } | |
| printf("\n\n"); | |
| printf("Now Please Enter the value of elements in the above manner:"); | |
| printf("\n"); | |
| printf("Note : Type Each Value and hit Enter :)"); | |
| printf("\n\n"); | |
| int arr[row][col]; | |
| int x; | |
| for (int i = 1; i<=row; i++){ | |
| for (int j = 1; j<=col; j++){ | |
| //int x; | |
| printf("\tValue at the place of %d%d : ",i,j); | |
| scanf("%d",&arr[i-1][j-1]);//&arr[i-1][j-1] | |
| } | |
| printf("\n"); | |
| } | |
| printf("\n Very Well, Heres Your Matrix XD\n\n\t"); | |
| for (int i = 1; i<=row; i++){ | |
| for (int j = 1; j<=col; j++){ | |
| printf("\t%d",arr[i-1][j-1]); | |
| } | |
| printf("\n\t"); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment