Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

why the output not showing

+3 votes
asked Feb 16 by Dipak Tigga (150 points)
#include<stdio.h>
int main()
{
    int i,j;
    int sum=0;
    int a[3][3];
    
    for(i = 0; i < 3; i++)
    {
        for(j = 0; j < 3; j++)
        {
            scanf("%d", & a[i][j]);
        }
    }
    for(i = 0; i < 3;i++)
    {
        for(j = 0; j < 3;j++ )
        {
            if(i==j)
            {
                sum = sum + a[i][j];
            }
        }
    }
    printf("Sum of Digonal matrix element is %d",sum);
    
    return 0;
}

1 Answer

0 votes
answered Feb 28 by Peter Minarik (86,240 points)
You first need to enter 9 numbers, then the program shows the result. It seems to work correctly for me.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...