style: format code (#4212)

close #4204
This commit is contained in:
acbin
2023-06-09 18:52:05 +08:00
committed by GitHub
parent ad03086f54
commit 00282efd8b
521 changed files with 5233 additions and 7309 deletions

View File

@ -2,8 +2,9 @@ package com.thealgorithms.maths;
import java.util.*;
/*A magic square of order n is an arrangement of distinct n^2 integers,in a square, such that the n numbers in all
rows, all columns, and both diagonals sum to the same constant. A magic square contains the integers from 1 to n^2.*/
/*A magic square of order n is an arrangement of distinct n^2 integers,in a square, such that the n
numbers in all rows, all columns, and both diagonals sum to the same constant. A magic square
contains the integers from 1 to n^2.*/
public class MagicSquare {
public static void main(String[] args) {
@ -22,10 +23,7 @@ public class MagicSquare {
magic_square[row_num][col_num] = 1;
for (int i = 2; i <= num * num; i++) {
if (
magic_square[(row_num - 1 + num) % num][(col_num + 1) % num] ==
0
) {
if (magic_square[(row_num - 1 + num) % num][(col_num + 1) % num] == 0) {
row_num = (row_num - 1 + num) % num;
col_num = (col_num + 1) % num;
} else {