LIST OF PROGRAMS
#include<stdio.h>#include<conio.h>
void main()
{
int i,j;
int a[100][100],sum=0,sum2=0,no2,no3,no;
clrscr();
printf("enter rows and columns of 1st array:- \n ");
scanf("%d",&no);
scanf("%d",&no2);
no3=no-1;
if(no==no2)
{
printf("ENTER NUMBERS IN ARRAY \n");
for(i=0;i<no;i++)
for(j=0;j<no2;j++)
{ fflush(stdin);
scanf("%d",&a[i][j]);
}
printf("ENTERED ARRAY \n");
for(i=0;i<no;i++)
{
for(j=0;j<no2;j++)
printf("\t %d",a[i][j]);
printf("\n");
}
for(i=0;i<no;i++)
sum+=a[i][i];
for(i=0;i<no;i++)
sum2+=a[i][no3-1];
printf("\nSUM OF LEFT DIAGONAL %d",sum);
printf("\nSUM OF RIGHT DIAGONAL %d",sum2);
}
else
printf("WRONG INPUT");
getch();
}
Comments