Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

PROGRAM TO PRINT MATRIX

Posted By: Vivian Ruiz     Category: C Programming     Views: 9129

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.

Vivian Ruiz
Vivian Ruiz author of PROGRAM TO PRINT MATRIX is from Wichita , United States. Vivian Ruiz says

 
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!