text: Program for Identity Matrix | C program to print Identity Matrix ; Checking if row is equal to column ; Driver Code
code: #include <stdio.h> NEW_LINE int Identity ( int num ) { int row , col ; for ( row = 0 ; row < num ; row ++ ) { for ( col = 0 ; col < num ; col ++ ) { if ( row == col ) printf ( " % d ▁ " , 1 ) ; else printf ( " % d ▁ " , 0 ) ; } printf ( " STRNEWLINE " ) ; } return 0 ; } int main ( ) { int size = 5 ; identity ( size ) ; return 0 ; }