+ 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
10 Antworten
+ 1
Abol سلام وقتتون بخیر،مربع جادویی مربعی ست که مجموع اعداد هر سطر با هر ستون و دو قطر اصلی و فرعی یکسان باشد
ورودی شامل عدد m (شروع اعداد) و عدد n (برای ساخت ماتریس n در n) میباشد
+ 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?
0
Abol while (1){...} in my code
Thanks for your explanation.