upper and lower diagonal

Discussion in 'C' started by Ziaur Rahman, Oct 26, 2006.

Thread Status:
Not open for further replies.
  1. Ziaur Rahman

    Ziaur Rahman New Member

    Joined:
    Oct 22, 2006
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    0
    Occupation:
    Student
    Location:
    Pune
    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");
     
    Last edited by a moderator: Oct 26, 2006
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Duplicate of [thread=1730]Find upper and lower diagonal of 3x3 matrices[/thread] article. Thread closed.
     
Thread Status:
Not open for further replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice