C program to find reciprocal of given matrix.

#include<stdio.h>
#include<conio.h>
#define r 2
#define c 2
void main(){
int a[r][c],b[r][c],i,j;
clrscr();
printf("Enter elements of matrix A\n");
for (i=0;i<r;i++){
for (j=0;j<c;j++){
printf("Enter A[%d][%d]= ",i,j);
scanf("%d",&a[i][j]);
}}
printf("Matrix A is:-\n"); 
for (i=0;i<r;i++){
for (j=0;j<c;j++){
printf("%d",a[i][j]);
}
printf("\n");
}
for (i=0;i<r;i++){
for (j=0;j<c;j++){
b[i][j]=a[j][i];
}}
printf("Reciprocal of Matrix A is:-\n"); 
for (i=0;i<r;i++){
for (j=0;j<c;j++){
printf("%d",b[i][j]);
}
printf("\n");
}
getch(); 
}

No comments:

Post a Comment