C program to print L diagonal triangle:
void main()
{
int i=0,j=0;
int arr[rows][cols];
for (i=0; i<=rows-1; i++)
for(j=0;j<=cols-1;j++)
{
printf("Enter elements (%d,%d)\n",(i+1),(j+1));
scanf("%d",&arr[i][j]);
}
for (i=0; i<=rows-1; i++)
{
printf("\t");
for(j=0;j<3;j++)
{
printf("%d ",arr[i][j]);
}
printf("\n");
}
printf("\n Revers of matrix\n");
for(i=0;i<=rows-1;i++)
{
printf("\t");
for(j=0;j<=cols-1;j++)
{
if(i==j)
printf("%d ",arr[i][j]);
else
printf(" ");
}
printf("\n");
}
}