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

Calculate the sum of each row and column and find transpose in C

Calculate the sum of each row and column and find transpose in C

#include <stdio.h>
int main()
{
       inta,b,c[100][100],i,j,sum=0;
       printf("Enter the number of rows and columns\n");
       scanf_s("%d%d" ,&a,&b);
       if(a!=b)
              return 0;
       printf("Enter the elemnts of matrix\n");
       for(i=0; i<a; i++)
       {
              for(j=0; j<a; j++)
              {
                  scanf_s("%5d" ,&c[i][j]);
              }
              printf("\n");
       }
       for(i=0; i<a; i++)
       {
              for(j=0; j<a; j++)
              {
                     if(i==j)
                           sum+=c[i][j];
              }
       }
       printf("Sum of diagonal elements is %d\n",sum);
       printf("Transpose is \n");
       for(i=0; i<a; i++)
       {
              for(j=0; j<a; j++)
              {
                     printf("%5d",c[j][i]);
              }
              printf("\n");
       }
       sum=0;

       for(i=0; i<a; i++)
       {
              for(j=0; j<a; j++)
              {
                     sum=sum+c[i][j];
              }
              printf("Sum of Row %d is %d\n" ,i,sum);
              sum=0;
       }
       sum=0;
       for(j=0; j<a; j++)
       {
              for(i=0; i<a; i++)
              {
                     sum=sum+c[i][j];
              }
              printf("Sum of column %d is %d\n" ,j,sum);
              sum=0;
       }

       getchar();
       getchar();
       return 0;
}