For beginners
{I am going write the c program but before you need a c compiler(software).there are a lot of compilers(software) for windows 7 like Code::Blocks,dev c++ . Download dev c++ its free and install it in your computer.open dev c++ go to file-->new-->source file.}
#include<conio.h>
#include<stdio.h>
main()
{
int m[10][10],a,b,c,d,sum=0;
printf(" enter row and colomn matrix");
scanf("%d%d",&a,&b);
printf(" enter the elements");
for(c=0;c<a;c++)
{
for(d=0;d<b;d++)
{
scanf("%d",&m[c][d]);
}
}
printf("the matrix is");
for(c=0;c<a;c++){
printf("\n");
for(d=0;d<b;d++)
{
printf("%d",m[c][d]);
}
}
printf("the the diagnal element is");
for(c=0;c<a;c++)
{
for(d=0;d<b;d++)
{if(c==d)
sum=sum+m[c][d];
}
}
printf("%d",sum);
getch();
}
For beginners
IS IT HELPFIL? comment.
{I am going write the c program but before you need a c compiler(software).there are a lot of compilers(software) for windows 7 like Code::Blocks,dev c++ . Download dev c++ its free and install it in your computer.open dev c++ go to file-->new-->source file.}
#include<conio.h>
#include<stdio.h>
main()
{
int m[10][10],a,b,c,d,sum=0;
printf(" enter row and colomn matrix");
scanf("%d%d",&a,&b);
printf(" enter the elements");
for(c=0;c<a;c++)
{
for(d=0;d<b;d++)
{
scanf("%d",&m[c][d]);
}
}
printf("the matrix is");
for(c=0;c<a;c++){
printf("\n");
for(d=0;d<b;d++)
{
printf("%d",m[c][d]);
}
}
printf("the the diagnal element is");
for(c=0;c<a;c++)
{
for(d=0;d<b;d++)
{if(c==d)
sum=sum+m[c][d];
}
}
printf("%d",sum);
getch();
}
For beginners
{After typing this program go to execute-->compile & run-->a window will pop-up-->give file name:(anything u like)-->save as type: c source files-->click save.}