+ 1

Magic square

I want to create a magic square: In recreational mathematics, a square array of numbers, usually positive integers, is called a magic square if the sums of the numbers in each row, each column, and both main diagonals are the same. Number starts with m and ends with m+ n^n -1 I wrote the code in cpp but not works correctly Can you help me to edit my code? https://code.sololearn.com/czESv4RXnysC/?ref=app

1st Feb 2021, 6:54 PM
Shakiba Majd
Shakiba Majd - avatar
10 Answers
+ 1
Abol سلام وقتتون بخیر،مربع جادویی مربعی ست که مجموع اعداد هر سطر با هر ستون و دو قطر اصلی و فرعی یکسان باشد ورودی شامل عدد m (شروع اعداد) و عدد n (برای ساخت ماتریس n در n) میباشد
2nd Feb 2021, 5:44 AM
Shakiba Majd
Shakiba Majd - avatar
+ 1
Abol Thanks for your edit but I can't get 'd' in inputs. How can it be changed without 'd'? And can't we write this program with just one infinite loop?
2nd Feb 2021, 4:11 PM
Shakiba Majd
Shakiba Majd - avatar
0
Abol while (1){...} in my code Thanks for your explanation.
2nd Feb 2021, 5:48 PM
Shakiba Majd
Shakiba Majd - avatar