Skip to content

Commit 414f197

Browse files
authored
Update and rename Magic Square to Magic Square.cpp
I have done your work @christian Bender. Kindly check it.
1 parent 6455322 commit 414f197

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

math/Magic Square renamed to math/Magic Square.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <bits/stdc++.h>
1+
#include <iostream>
22

33
#define N 3
44
using namespace std;
@@ -41,9 +41,13 @@ bool isMagicSquare(int mat[][N])
4141

4242
int main()
4343
{
44-
int mat[][N] = {{ 2, 7, 6 },
45-
{ 9, 5, 1 },
46-
{ 4, 3, 8 }};
44+
int mat[3][N] ,i,j;
45+
46+
for(i=0; i<3; i++)
47+
{
48+
for(j=0; j<3; j++)
49+
cin>>mat[i][j];
50+
}
4751

4852
if (isMagicSquare(mat))
4953
cout << "Magic Square";

0 commit comments

Comments
 (0)