Professional Documents
Culture Documents
Output:: Enter The Number of Rows (Between 1 and 100) : 2
Output:: Enter The Number of Rows (Between 1 and 100) : 2
#include <stdio.h>
int main() {
int r, c, a[100][100], b[100][100], sum[100][100], i, j;
printf("Enter the number of rows (between 1 and 100): ");
scanf("%d", &r);
printf("Enter the number of columns (between 1 and 100): ");
scanf("%d", &c);
return 0;
}
Output:
Enter the number of rows (between 1 and 100): 2
Enter the number of columns (between 1 and 100): 3
10 8 6
subtraction of matrix:
#include <stdio.h>
int main() {
int r, c, a[10][10], b[10][10], sum[10][10], i, j;
printf("Enter the number of rows (between 1 and 100): ");
scanf("%d", &r);
printf("Enter the number of columns (between 1 and 100): ");
scanf("%d", &c);
return 0;
}
output:
Enter the number of rows (between 1 and 100): 2
Enter the number of columns (between 1 and 100): 2
Enter elements of 1st matrix:
Enter element a11: 1
Enter element a12: 2
Enter element a21: 3
Enter element a22: 4
Enter elements of 2nd matrix:
Enter element b11: 1
Enter element b12: 2
Enter element b21: 3
Enter element b22: 4
Sum of two matrices:
0 0
0 0
Matrix multiplication:
#include<stdio.h>
int main()
int r1,r2,c1,c2;
scanf("%d",&r1);
scanf("%d",&c1);
scanf("%d",&r2);
scanf("%d",&c2);
if(c1!=r2)
else
int m1[r1][c1],m2[r2][c2];
for(int i=0;i<r1;i++)
for(int j=0;j<c1;j++)
scanf("%d",&m1[i][j]);
}
for(int i=0;i<r2;i++)
for(int j=0;j<c2;j++)
scanf("%d",&m2[i][j]);
int mul[r1][c2];
for(int i=0;i<r1;i++)
for(int j=0;j<c2;j++)
mul[i][j]=0;
for(int k=0;k<c1;k++)
mul[i][j]+=m1[i][k]*m2[k][j];
printf("Multiplied matrix\n");
for(int i=0;i<r1;i++)
{
for(int j=0;j<c2;j++)
printf("%d\t",mul[i][j]);
printf("\n");
return 0;
output:
Enter number of rows for First Matrix:
2
Enter number of columns for First Matrix:
2
Enter number of rows for Second Matrix:
3
Enter number of columns for Second Matrix:
3
Matrices Can't be multiplied together
4
5
6Multiplied matrix
20 12
96 55
Output
Enter rows and columns: 2
3
Enter matrix elements:
Enter element a11: 1
Enter element a12: 4
Enter element a13: 0
Enter element a21: -5
Enter element a22: 2
Enter element a23: 7
Entered matrix:
1 4 0
-5 2 7
write a program that shows the binary equivalent of a given positive number between 0 to 255
#include<stdio.h>
int main(){
int a[10],n,i;