0% found this document useful (0 votes)
6 views3 pages

Assignment No 08

Uploaded by

khanshayan42788
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Assignment No 08

Uploaded by

khanshayan42788
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Object : Write a program in C to transpose of a 2- dimensional matrix.

Input :

#include<stdio.h>

#include<conio.h>

int main()

clrscr();

printf(“ Abu Shayan Salim \n”);

int i,j;

int a[3][3], transpose [3][3],r,c;

printf(“ enter rows and columns:”);

scanf(“%d%d,&r,&c);

printf(“\n enter matrix elements:\n”);

for(i=0; i<r; ++i)

for(j=0; j<c; ++j)

printf (“ enter element a%d%d:”,i,j);

scanf(“%d”,&a[i][j]);

for(i=0; i<r; ++i)

for(j=0; j<c; ++j)

{
printf (“%d”, a[i][j]);

if( j==c-1)

printf(“\n”);

for(i=0; i<r; ++i)

for(j=0; j<c; ++j)

transpose [j][i]= a[i][j];

printf (“\n transpose \n”);

for(“ i=0; i<r; ++i)

for(j=0; j<c; ++j)

printf (“%d”, transpose [i][j]);

if (j==r-1);

printf (“\n”);

}
getch();

return 0;

Output :

You might also like