/*** Program to Print Transpose of a Matrix ***/
#include
main()
{
int a[10][10], i, j, row, col;
printf("\nEnter no. of rows & columns: ");
scanf("%d %d", &row, &col);
printf("\nEnter elements of Matrix:\n");
for (i=0; i
printf("\n\nElements of Matrix:\n\n");
for (i=0; i
for (j=0; j
printf("\n\n");
}
printf("\n\nTranspose of Matrix:\n\n");
for (i=0; i
for (j=0; j
printf("\n\n");
}
getch();
}
program to multiply to matrix
#include
void main()
{
int a[10][10], b[10][10], c[10][10], i, j, k, r1, r2, c1, c2;
back:
printf("\nEnter no. of rows and columns of Matrix A: ");
scanf("%d %d", &r1, &c1);
printf("\nEnter no. of rows and columns of Matrix B: ");
scanf("%d %d", &r2, &c2);
if (c1 != r2)
{
printf("\n\nMultiplication is not possible\n");
goto back;
}
printf("\n\nEnter elements of Matrix A:\n");
for (i=0; i
printf("\nEnter elements of Matrix B:\n");
for (i=0; i
printf("\n\nElements of Matrix A:\n\n");
for (i=0; i
for (j=0; j
printf("\n\n");
}
printf("\n\nElements of Matrix B:\n");
for (i=0; i
for (j=0; j
printf("\n\n");
}
for (i=0; i
c[i][j] = 0;
for (k=0; k
}
printf("\n\nMultiplication of Matrices:\n\n");
for (i=0; i
for (j=0; j
printf("\n\n");
}
getch();
}
perfect no check
void main()
{
int i,no,sum=0;
clrscr();
printf("Enter no : ");
scanf("%d",&no);
for (i=1; i
if (no%i==0)
sum=sum+i;
}
if (no==sum)
printf("\n %d is a Perfect Number",no);
else
printf("\n %d is not a Perfect Number",no);
getch();
}