Demo entry 6660929

c

   

Submitted by anonymous on Nov 18, 2017 at 03:36
Language: C. Code size: 345 Bytes.

#include<stdio.h>
void main (void)
{
	int i,j,k,arr[100][100];
    printf("please enter the number of unit matrix(less than 100):\n");
	scanf("%d",&k);
	for(i=1;i<=k;i++)
	  { for(j=1;j<=k;j++)
	   {
		   if(i==j)
			  arr[i][j]=1;
		   else
			   arr[i][j]=0;
		       printf("%d ",arr[i][j]);
	   }
			   printf("\n");
	   }
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).