i need a C program that will do this Write a program that cr
i need a C program that will do this
Write a program that creates a multiplication table. Write a program that can multiply two matrixes.Solution
C program that creates a multiplication table :-
#include <stdio.h>
int main()
{
int n, i ; // variable declaration
printf(\"Enter an integer for which you want to print multiplication table: \") ;
scanf(\"%d\",&n) ; // scanf reads the user entered value
for(i=1; i<=20; ++i)
{
printf(\"%d * %d = %d \ \", n, i, n*i) ; // printf prints the multiplication table
}
return 0 ;
}
C program that can multiply two matrixes :-
#include<stdio.h>
int main()
{
int p[10][10],q[10][10],r[10][10],l,m,n;
printf(\"Enter the matrix P\") ;
for(l=0;l<3;l++)
{
for(m=0;m<3;m++)
{
printf(\"P[%d][%d] : \",l+1,m+1) ;
scanf(\"%d\",&p[l][m]) ;
}
}
printf(\"Enter the matrix Q\") ;
for(l=0;l<3;l++)
{
for(m=0;m<3;m++)
{
printf(\"Q[%d][%d] : \",l+1,m+1) ;
scanf(\"%d\",&q[l][m]) ;
}
}
for(l=0;l<3;l++)
{
for(m=0;m<3;m++)
{
r[l][m]=0 ;
for(n=0;n<3;n++)
{
r[l][m] = r[l][m]+p[l][n]*q[n][m] ;
}
printf(\"\\t%d\",r[l][m]) ;
}
printf(\"\ \ \") ;
}
return 0;
}

