Unit Matrix In C Program Tamil


#include<stdio.h>
#include<conio.h>
void main()
{
   int a[3][3],i,j,n=3,k=0;
   clrscr();
   printf("\nEnter the values \n");
   for(i=0;i<n;i++)
   {
       for(j=0;j<n;j++)
       {
	 scanf("%d",&a[i][j]);
       }
   }
   printf("\nMatrix\n");
   for(i=0;i<n;i++)
   {
       for(j=0;j<n;j++)
       {
	 printf(" %d",a[i][j]);
       }
       printf("\n");
   }
   for(i=0;i<n;i++)
   {
       for(j=0;j<n;j++)   //www.tutorjoes.com
       {

	    if((i==j&&a[i][j]==1)||(i!=j&&a[i][j]==0))
	    {
	       k++;
	    }
	}
   }
   if(k==(n*n))           //www.tutorjoes.com
   {
      printf("\nGiven matrix is unit ");
   }
   else
   {
      printf("\nGiven matrix is not unit");
   }
   getch();
}

Login To Download Source Code

Leave a Comment:

Login To Comment

List Of Programs


Goto Examples

Operators

Looping

Number Conversion

Pattern Design

Arrays

Matrix Examples

Sorting Examples

String Function

Change Case

String In C

Maths Functions

User Defined Functions

Recursive Functions

Pointer

Structure

File Concept

Calender Programming