Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   upper and lower diagonal (http://www.go4expert.com/forums/upper-lower-diagonal-t1733/)

Ziaur Rahman 26Oct2006 18:52

upper and lower diagonal
 
Code:

#include<conio.h>
#include<stdio.h>
void main()
{
  int a[3][3],i,j,k;
  clrscr();
  printf("\n Enter a Matrix 3x3:\n\n");
  for(i=0;i<=2;i++)
  {
  for(j=0;j<=2;j++)
  {
  scanf("%d",&a[i][j]);
  }
  }
  /* Displaying entered matrix 3x3*/
  printf("\n The Matrix is:-\n");
  for(i=0;i<=2;i++)
  {
  for(j=0;j<=2;j++)
  {
      printf("%d\t",a[i][j]);
  }
      printf("\n");
  }
  printf("\n");
  printf("\n Lower diagonal:\n\n");
  for(i=1;i<=2;i++)
  {
  for(j=0;j<i;j++)
  {
  printf("%d\t",a[i][j]);
  }
  printf("\n");
  }
  printf("\n \n");
  printf("\n Upper diagonal\n");


shabbir 26Oct2006 19:42

Re: upper and lower diagonal
 
Duplicate of Find upper and lower diagonal of 3x3 matrices article. Thread closed.


All times are GMT +5.5. The time now is 14:07.