Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » BeginnersRSS Feeds

PROGRAM TO PRINT MATRIX

Posted By: Lu Fischer     Category: C Programming     Views: 2713

WRITE A PROGRAM TO PRINT MATRIX.

Code for PROGRAM TO PRINT MATRIX in C Programming

#include<stdio.h>
#include<conio.h>
void main()
{
    int i,j,d[10][10];
    clrscr();
    for(i=1;i<=10;i++)
    {
        for(j=1;j<=10;j++)
        {
            if(i==j)
            {
                d[i][j]=1;
            }
            else
            {
                d[i][j]=0;
            }
            printf("%d  ",d[i][j]);
        }
        printf("\n");
    }
    getch();
}

/*
*********
OUTPUT
*********

1 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0
0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 1
*/
  
Share: 


Didn't find what you were looking for? Find more on PROGRAM TO PRINT MATRIX Or get search suggestion and latest updates.

Lu Fischer
Lu Fischer author of PROGRAM TO PRINT MATRIX is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!