MAGIC SQUARES The exercise for today is to write the pseudocode and C program for constructing magic squares. The magic square is n x n square grid (where n is the number of cells on each side) filled with distinct positive integers in the range 1 , 2 , . . . , n^2 such that each cell contains a different integer and the sum of the integers in each row, column and diagonal is equal. The sum is called the magic constant or magic sum of the magic square and can be calculated: M = n(n^2+1)/2 A square grid with n cells on each side is said to have order n. Read: https://en.wikipedia.org/wiki/Magic_square Ex 1: Go to paragraph "A Method for constructing a magic square of odd order" (aka Siamese method) and implement it. Ex 2: Go to paragraph "A method of constructing a magic square of doubly even order" (aka Doubly even) and implement it. See also: http://www.1728.org/magicsq1.htm http://www.1728.org/magicsq2.htm Coding basics: Conditional or Ternary Operator (?:) in C (alternative for if-else) https://www.geeksforgeeks.org/conditional-or-ternary-operator-in-c/ Extra task (only for those who want): Implement a naive algorithm that goes through all possibilities and find all magic squares of a given size. ======================================================================================================= Homework: Send to lukaskoz@mimuw.edu.pl an email with the subject "lab5 NameSurname WI 2023" (e.g. "lab5 LukaszKozlowski WI 2023", without polish letters) and the attachments: - *.c file with the code of Ex 1 and Ex 2 (implemented as the separate functions, n (size of the square) should be given by the user, the output should be printed into the screen) - the pdf file should contain: a) the pseudocode b) C implementation (the code) c) additionally, the pdf file should contain print out for at least two examples of magic squares e.g. for n=5, n=7 and n=4 and n=8. Deadline: 12.11.2023 16:00 (Monday Group) or 14.11.2023 16:00 (Wednesday Group) =====================================================================================================