➽ Problem:-

https://www.hackerrank.com/challenges/diagonal-difference/problem

➽ Solution:-

#include <assert.h>

#include <ctype.h>

#include <limits.h>

#include <math.h>

#include <stdbool.h>

#include <stddef.h>

#include <stdint.h>

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

 

int main()

{

    int N;

    scanf("%d", &N);

    int A[N];

    int LDS=0;

    int RDS=0;

   

    for(int i=0; i<N; i++)

    {

        for(int j=0; j<N; j++)

        {   

            scanf("%d", &A[i]);   

            if(i==j)

                LDS += A[i];

            if(i+j==N-1)

                RDS += A[i];

        }

    }

 

    printf("%d", abs(LDS - RDS));

    return 0;

}