This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: for (int row = 0; row < size; row++) System.out.println ("Sum of row " + row + ": " + magicSquare.sumRow(row)); //print the sums of its columns for (int col = 0; col < size; col++) System.out.println ("Sum of column " + col + ": " + magicSquare.sumCol(col)); //print the sum of the main diagonal System.out.println ("Sum of the main diagonal: " + magicSquare.sumMainDiag()); //print the sum of the other diagonal System.out.println ("Sum of the other diagonal: " + magicSquare.sumOtherDiag()); //determine and print whether it is a magic square if (magicSquare.magic()) System.out.println ("It's a magic square!"); else System.out.println ("It's not a magic square!"); System.out.println(); //get size of next square size = scan.nextInt(); count++; } } }...
View Full Document
This note was uploaded on 03/22/2010 for the course CS 202 taught by Professor Fong during the Spring '10 term at SIU Carbondale.
- Spring '10
- Computer Science