Step 4. Click on the Save Template button To make this youtube playlist work we need to add the HTML structure of it: Step 5. Go to Layout or Pages or anywhere you want to add it and add the following code inside the HTML area (if you want to add it as a widget, paste the code inside a HTML/Javascript gadget by clicking on Add a gadget link within the Layout/Page Elements section):

Search This Blog

Follow me on Facebook

function to add two matices in C easy


Make a function to add two matrices
#include <stdio.h>
int matrix();

int main()
{
       matrix(); //calling function
}


int matrix()
{
      
       int a[10][10],b[10][10],add[10][10],p,q,i,j;    //a=first matrix , b=second matrix , i & j conytolling loops
       printf("Enter the order of the two matices\n");
       scanf("%d%d" , &p , &q);
       for(i=0; i<p; i++)
       {
              for(j=0; j<q; j++)
              {

       printf("Enter the entry for %d row and %d column for Ist matrix\n" , i+1 ,j+1);
       scanf("%d" , &a[i][j]);
              }
       }

       for(i=0; i<p; i++)
       {
              for(j=0; j<q; j++)
              {
                     printf("Enter the value for %d row and %d column for 2nd matrix\n" ,i+1 , j+1);
                     scanf("%d" , &b[i][j]);
              }
       }
       for(i=0; i<p; i++)
       {
              for(j=0; j<q; j++)
              {

       add[i][j]=a[i][j]+b[i][j];
      
              }
       }
       printf("SUM of the matrices is \n");

       for(i=0; i<p; i++)
       {
              for(j=0; j<q; j++)
              {
                     printf("%d\t" , add[i][j]);
                    
              }
              printf("\n");
       }
       return 0;
}
function to add two matrices in C