Wednesday, 13 August 2014

//LOWER LEFT MATRIX
//CODE

#include<stdio.h>
#include<conio.h>
clrscr();
main()
{
 int i,j,n;
 int a[10][10];
 printf("\n Enter the size of the array:");
 scanf("%d",&n);
 printf("\n Enter the elements:");
 for(i=0;i<n;i++)
 {
   for(j=0;j<n;j++)
   {
       scanf("%d",&a[i][j]);             
   }
 }
 printf("\n The lower left matrix is as follows:\n ");
 for(i=0;i<n;i++)
 {
   for(j=0;j<=i;j++)
   {
         printf("\t%d",a[i][j]);
  }
  printf(" \n");
 }
getch();
return 0;
}

//OUTPUT
Enter the size of the array:3
Enter the elements:1
2
3
4
5
6
7
8
9

The lower left matrix is as follows:
1
4  5
7  8  9
 

1 comment:

  1. What is the use of clrscr() in this program???

    ReplyDelete

Note: only a member of this blog may post a comment.