1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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,287
    Likes Received:
    364
    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