/*
	Sample code to print an identity matrix using nested loops
*/

import java.io.*;

public class ident {
    
    public static void main(String args[]) {
	int	 nn;	// size of square matrix
	int	 row;	// loop index
	int	 col;	// loop index

	// initialize parameters
	nn = 5;

	// print an nn x nn identity matrix

	// for each row
	for (row = 1; row <= nn; row++)
	{
	   // print the columns (spaces) in that row
	   for (col = 1; col <= nn; col++)
	   {
	      if (row == col)
	         System.out.print ("1 ");
	      else
	         System.out.print ("0 ");
	   }
	   // go to the next row (line)
	   System.out.print ("\n");
	}
	System.out.flush ();
    }

}
