[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 379: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_content.php on line 678: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_content.php on line 678: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/session.php on line 1042: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
DOEACC FORUM • View topic - PROJECT: Transpose of Matrix
Page 1 of 1

PROJECT: Transpose of Matrix

Unread postPosted: Thu May 22, 2008 5:59 pm
by rajeevmahura
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10][10],b[10][10];
int i,j,r,c;
clrscr();
printf("Enter Number of Rows:- ");
scanf("%d",&r);
printf("Enter Number of Columns:- ");
scanf("%d",&c);
for(i=1;i<=r;i++)
{
for(j=1;j<=c;j++)
{
printf("Enter Any Number for Matrix a[%d][%d] ",i,j);
scanf("%d",&a[i][j]);
}
}
printf("\nAfter");
for(i=1;i<=r;i++)
{
for(j=1;j<=c;j++)
{
printf("\t%d",a[i][j]);
}
printf("\n");
}
printf("\nBefore");
for(i=1;i<=r;i++)
{
for(j=1;j<=c;j++)
{
printf("\t%d",a[j][i]);
}
printf("\n");
}
getch();
}
------------------------------------------------------------------------------
Input:r=2,c=2,a[1][1]=2,a[1][2]=3,a[2][1]=4,a[2][2]=5
Output:After 2 3
4 5

Before 2 4
3 5