Professional Documents
Culture Documents
Q1(a).
#include<stdio.h>
int main()
{
int row,col,c;
int i,j;
printf("Enter the no. of Rows of the matrix:");
scanf("%d",&row);
printf("Enter the no. of Columns of the matrix:");
scanf("%d",&col);
int A[row][col];
printf("Enter the elements of the matrix : ");
for( i=0;i<row;i++)
{
for( j=0;j<col;j++)
{
scanf("%d",&A[i][j]);
}
}
for( i=0;i<row;i++)
{
for( j=0;j<col;j++)
{
A[i][j]=c*A[i][j];
printf("|| %d ||",A[i][j]);
}
printf("\n");
}
return 0;
}
Q1(b).
#include<stdio.h>
int main()
{
int A[3][3],B[3][3],i,j;
printf("Enter the matrix\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&A[i][j]);
printf("\n");
}
}
Q1.(c)
#include<stdio.h>
int main()
{
int A[3][3],B[3][3],C[3][3],i,j,k;
printf("Enter the first matrix\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&A[i][j]);
printf("\n");
}
//multiplying matrix
for(i=0;i<3;i++)
for(j=0;j<3;j++)
{
C[i][j]=0;
for(k=0;k<3;k++)
C[i][j]+=A[i][k]*B[k][j];
}
Q3.
#include<stdio.h>
int main()
{
int A[10],i,max=0;
printf("Enter the number array(Total 10)\n");
for(i=0;i<10;i++)
scanf("%d",&A[i]);
//finding maximum
for(i=0;i<10;i++)
if(A[i]>max)
max=A[i];
printf("\nThe array is\n");
for(i=0;i<10;i++)
printf("%d\t",A[i]);
//minimum
min=A[0][0];
for(i=0;i<3;i++)
for(j=0;j<3;j++)
if(A[i][j]<min)
min=A[i][j];
return 0;
}