//Sum of lower triangular elements using DMA
#include <stdio.h>
#include <math.h>
void main(){
    int a,b,sum=0;
    printf("ENTER ROWS =\n");
    scanf("%d",&a);
    printf("ENTER Column =\n");
    scanf("%d",&b);
    int arr[a][b],*p,*q;
    printf("ENTER THE ELEMENT OF MATRIX =\n");
    for(int i=0;i<a;i++){
        for(int j=0;j<b;j++){
            scanf("%d",&arr[i][j]);
        }
    }
    printf("%d * %d matrix\n",a,b );
      for(int i=0;i<a;i++){
        for(int j=0;j<b;j++){
            printf("\t%d",arr[i][j]);
        }
        printf("\n");
    }
    printf("THE lower diagonal element = \n");
      for(int i=0;i<a;i++){
        for(int j=0;j<b;j++){
           if(i>j){
               p=&arr[i][j];
               printf("%d ",*p);
               sum=sum+*p;
              //  printf("\n");
           }
           if(j>0)
           printf("\n");
        }
    }
    printf("THE SUM OF LOWER DIAGONAL ELEMENT =%d",sum);
    
    
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: