#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{ clrscr();
int
a[3][3],i,j,b[3][3],c[3][3],k,sum;
printf("enter
numbers for 3*3 array:\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{ scanf("%d",&a[i][j]);
}
printf("\n");
}
printf("********output********\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{ printf("%d ",a[i][j]);
}
printf("\n");
}
sum=0;
for(i=0;i<=2;i++)
{
sum=sum+a[i][i]; }
printf("Diagonal add=%d
",sum);
getch();
}
No comments:
Post a Comment
Please comment bellow. Share your knowledge