Program
#include<stdio.h>
main()
{
int arr[3][3],i,j,sum=0;
printf("enter the 3*3 matrix");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&arr[i][j]);
}
}
for(i=0,j=2;i<3;i++,j--)
{
sum+=arr[i][j];
}
printf("Sum= %d",sum);
}
Output
enter the 3*3 matrix
5 3 6
2 6 8
2 5 7
Sum= 14
#include<stdio.h>
main()
{
int arr[3][3],i,j,sum=0;
printf("enter the 3*3 matrix");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&arr[i][j]);
}
}
for(i=0,j=2;i<3;i++,j--)
{
sum+=arr[i][j];
}
printf("Sum= %d",sum);
}
Output
enter the 3*3 matrix
5 3 6
2 6 8
2 5 7
Sum= 14
absolutely incorrect!
ReplyDeleteI definitely enjoying every little bit of it. It is a great website and nice share. I want to thank you. Good job! You guys do a great blog, and have some great contents. Keep up the good work. c program for lcm of two numbers
ReplyDelete