c program to perform transpose of a matrix
C
#include <stdio.h>
int main() {
int a[10][10], transpose[10][10], r, c, i, j;
printf("Enter rows and columns: ");
scanf("%d %d", &r, &c);
// Assigning elements to the matrix
printf("\nEnter matrix elements:\n");
for (i = 0; i < r; ++i)
for (j = 0; j < c; ++j) {
printf("Enter element a%d%d: ", i + 1, j + 1);
scanf("%d", &a[i][j]);
}
// Displaying the matrix a[][]
printf("\nEntered matrix: \n");
for (i = 0; i < r; ++i)
for (j = 0; j < c; ++j) {
printf("%d ", a[i][j]);
if (j == c - 1)
printf("\n");
}
// Finding the transpose of matrix a
for (i = 0; i < r; ++i)
for (j = 0; j < c; ++j) {
transpose[j][i] = a[i][j];
}
// Displaying the transpose of matrix a
printf("\nTranspose of the matrix:\n");
for (i = 0; i < c; ++i)
for (j = 0; j < r; ++j) {
printf("%d ", transpose[i][j]);
if (j == r - 1)
printf("\n");
}
return 0;
}
Also in C:
- Title
- passing 2d array as parameter to function in c
- Category
- C
- Title
- primo
- Category
- C
- Title
- stack implementation
- Category
- C
- Title
- fibonacci in c
- Category
- C
- Title
- c isdigit function
- Category
- C
- Title
- qtableview get selected row
- Category
- C
- Title
- c zero out array
- Category
- C
- Title
- c check if array is empty
- Category
- C
- Title
- c float to int
- Category
- C
- Title
- C/c drop mime
- Category
- C
- Title
- iterate through map
- Category
- C
- Title
- measure time in c
- Category
- C
- Title
- compare two chars c
- Category
- C
- Title
- how to call the tkinter insert command from another class
- Category
- C
- Title
- multiplication in c
- Category
- C
- Title
- malloc in c
- Category
- C
- Title
- change a attribute in dataframe
- Category
- C
- Title
- a enum data type in c
- Category
- C
- Title
- get current used proxy windows 7
- Category
- C
- Title
- hentai clochette
- Category
- C
- Title
- networkx remove attributes
- Category
- C
- Title
- get configuration script window 7
- Category
- C
- Title
- how to mutex lock in c
- Category
- C
- Title
- lelcetric fied
- Category
- C
- Title
- kadane's algorithm
- Category
- C
- Title
- for loop in c
- Category
- C
- Title
- windeployqt example
- Category
- C
- Title
- use of matplotlib inline
- Category
- C
- Title
- css selector for sibling element
- Category
- C
- Title
- resto de division recursiva
- Category
- C
- Title
- curl post request
- Category
- C
- Title
- c matrix sintax
- Category
- C
- Title
- a enum data type in c with loop
- Category
- C
- Title
- what is stdin in c
- Category
- C
- Title
- last element from list javascript
- Category
- C
- Title
- How to setup a line length marker in vim
- Category
- C
- Title
- router solicitation and advertisement magic is used by
- Category
- C
- Title
- how to free memory in c
- Category
- C
- Title
- how to use a pointer as a parameter in c
- Category
- C
- Title
- confirm sweet alert
- Category
- C
- Title
- maximo comun divisor
- Category
- C
- Title
- docker pull command
- Category
- C
- Title
- Print the number 0 using write()
- Category
- C
- Title
- convert string to float c
- Category
- C
- Title
- accessing elements of 1d array using pointers
- Category
- C
- Title
- how to open chrome using cmd
- Category
- C
- Title
- scanf read line
- Category
- C
- Title
- ModuleNotFoundError: No module named 'tensorboardX'
- Category
- C
- Title
- c bitwise operators
- Category
- C
- Title
- delete docker image repository none
- Category
- C
- Title
- remove element queue
- Category
- C
- Title
- heitai bestial
- Category
- C
- Title
- how to write function in c
- Category
- C
- Title
- how to feed a char array to function in C
- Category
- C
- Title
- 233 pounds to inr
- Category
- C
- Title
- pi in c language
- Category
- C
- Title
- pasar a binario recursivo
- Category
- C
- Title
- c printf uint32_t
- Category
- C
- Title
- command line coursera
- Category
- C
- Title
- error: ‘cout’ was not declared in this scope
- Category
- C
- Title
- duplicar cadena
- Category
- C
- Title
- download android ndk r 16
- Category
- C
- Title
- what is strikethrough in markdown
- Category
- C
- Title
- calculate max of three numbers using ternary operator in c
- Category
- C
- Title
- add border to image android
- Category
- C
- Title
- allocate memory c
- Category
- C
- Title
- csrf_exempt
- Category
- C
- Title
- azure storage emulator config
- Category
- C
- Title
- first person view unity
- Category
- C
- Title
- c bit access struct
- Category
- C
- Title
- piramide
- Category
- C
- Title
- How to pass a struct value to a pthread in c?
- Category
- C
- Title
- sustituir un dígito por otro
- Category
- C
- Title
- select all file from date powershell
- Category
- C
- Title
- code: 'EADDRINUSE', [0] errno: 'EADDRINUSE', [0] syscall: 'listen', [0] address: '::', [0] port: 5000
- Category
- C
- Title
- \0 in c
- Category
- C
- Title
- how to do matrix multiplication in c
- Category
- C
- Title
- how to free a 2d array correctly
- Category
- C
- Title
- jock cranley
- Category
- C
- Title
- atoi
- Category
- C
- Title
- left me on read
- Category
- C
- Title
- how to sleep in c
- Category
- C
- Title
- how to check where the last char is in a string c
- Category
- C
- Title
- reset style matplotlib
- Category
- C
- Title
- pop and push shows black screen which needs to be pressed back flutter
- Category
- C
- Title
- write a program to ask the user 8 integer numbers. your program will then move all negative elements of your array to the end of the array without changing the order of positive elements and negative elements
- Category
- C
- Title
- c defined value sum
- Category
- C
- Title
- Assign integer value to pointer?
- Category
- C
- Title
- matplotlib plot circle marker
- Category
- C
- Title
- c program to find the sum of given number using recursion
- Category
- C
- Title
- c check if file was created
- Category
- C
- Title
- array length c
- Category
- C
- Title
- entity framework core discard changes
- Category
- C
- Title
- reset c array to zero
- Category
- C
- Title
- how to get random numbers in c
- Category
- C
- Title
- c value set to zero __memmove_avx_unaligned_erms
- Category
- C
- Title
- c get first n characters of string
- Category
- C
- Title
- how can i remove a specific item from an array
- Category
- C
- Title
- mitch mcconnell
- Category
- C
- Title
- XAudio2 C
- Category
- C