Write a program that reads a square array of integers

Assignment Help Computer Engineering
Reference no: EM131847364

Problem

A magic square is a square array of integers such that the sum of every row, the sum of every column, and sum of each of the two diagonals are all equal. Two magic squares are shown in Figure 1.5.

2353_Two magic squares.jpg

(a) Write a program that reads a square array of integers and determines whether or not it is a magic square.

(b) Write a program that generates a magic square by the following method. This method works only when the size of the square is an odd number. Start by placing 1 in the middle of the top row. Write down successive integers 2, 3, ... along a diagonal going upward and to the right. When you reach the top row (as you do immediately since 1 is in the top row), continue to the bottom row as though the bottom row were immediately above the top row. When you reach the rightmost column, continue to the leftmost column as though it were immediately to the right of the rightmost one. When you reach a position that is already occupied, instead drop straight down one position from the previous number to insert the new one. The 5 × 5 magic square constructed by this method is shown in Figure 1.5.

Reference no: EM131847364

Questions Cloud

Discuss the Richard decision-making process : Can you replicate Richard's decision-making process as he chose a TV brand for other consumers or other products? Create a grid for a different product category
Discuss the importance of creating information security : A few samples of employee information security policies specifically for Making The Grade. Other major areas the information security plan should address.
How is the vaccine administered : How is the vaccine administered? Does the vaccine need to be repeated? If so, how often?
What journal entry shaw company record on december : Shaw Company's fiscal year-end is December 31. What journal entry, if any, should Shaw Company record on December 31, 20X6
Write a program that reads a square array of integers : Write a program that reads a square array of integers and determines whether or not it is a magic square.
Discuss the impact of using immune modulators in children : Discuss the impact of using immune modulators in children, adults ,and older adults. Determine unique risk factors based on age group.
Describe the role of immune modulators : Describe the role of immune modulators. What is the difference between immune modulators and immune suppressants?
Create two versions of the given scenario : Extraneous characteristics of the choice situation can influence our selections, even though they wouldn't if we were totally rational decision makers.
Create an argument for or against the stealing software : Considering this, is it reasonable to blame someone for using pirated software when it could potentially cost him or her two months' salary to purchase a legal?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd