pa5 - COP 3275 Programming Using C Language Fall 2011,...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COP 3275 Programming Using C Language Fall 2011, Programming Assignment #5 Yi Wang Radhika Medury Min Chen yiwan@cise.ufl.edu rmedury@cise.ufl.edu min@cise.ufl.edu Due Date: Wed. Dec 07, 2011 @ 12:00pm (noon) NO Late submission is accepted! Problem description: Write a program that prints an nxn matrix square (a square arrangement of the numbers 1,2,…n^2 in which the sum of the rows ,columns, and diagonals are all the same). The user will specify the value of n: This program creates a magic square of a specified size. The size must be an odd number between 1 and 99. Enter size of magic square : 5 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 Store the magic square in a two dimensional array. Start by placing the number 1 in the middle of row 0.Place each of the remaining numbers 2,3,…n^2 by moving up one row and over one column. Any attempt to go outside the bounds of the array should “wrap around” to the opposite side of the array. For example, instead of storing the next number in row -1, we
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

pa5 - COP 3275 Programming Using C Language Fall 2011,...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online