Arrangement of numbers in a square

Assignment Help Business Management
Reference no: EM132222085

Question 1:

Purpose: To build a program and test it. To get warmed up with Python, in case you are using it for the rst time.

A Magic Square is an arrangement of numbers in a square, so that every row, column, and diagonal add up to the same value. Below are two squares, but only one of them is a Magic Square.

8 1 6

3 5 7

4 9 2

1 9 6

5 3 7

4 8 2

The square on the left is a 3 3 magic square, whose rows, columns, and diagonals all sum to 15. On the right, is a 3 3 square of numbers whose rows columns and diagonals don't have the same sum.

There are magic squares of all sizes (except 22), but we'll be concerned with 33 squares, and checking if a given arrangement of 9 numbers is a magic square or not.

Denition: A 3 3 magic square is formally dened by the following three criteria:

It contains the integers 1 through 9 inclusively.

Every integer in the range 1 through 9 appears exactly once.

Every row, column, and diagonal sums to 15.

In this question you will implement a program that does the following:

It asks the user for a sequence of 9 numbers from the console. The order of the numbers is important, as the rows of the grid use this order. For simplicity, assume that the user will type integers on the console. For this question, you don't have worry about what to do if the user types anything other than integers.

It checks whether the sequence of integers is a magic square or not. Your program should display the message "yes" if it's magic, or "no" if it's not.

It's very important to point out that you are not being asked to construct a magic square; only to check if a square is magic or not.

Reference no: EM132222085

Questions Cloud

What does access control lists mean : What does access control lists mean? And what is its significance in an organization?
English representation of the code : Given the following code, write the English representation of the code. Post your response below for review by your peers, and give feedback on structure
Develop program for effectively managing diversity : Explain the potential advantages of e-learning for training. Develop a program for effectively managing diversity.
Implement a data mining process : You are a data mining consultant hired by your organization to implement a data mining process.
Arrangement of numbers in a square : A Magic Square is an arrangement of numbers in a square, so that every row, column, and diagonal add up to the same value. Below are two squares
Positively and negatively impact supply chain performance : Provide examples of how transportation can positively and negatively impact supply chain performance.
Print the number of lines in the text le myfile : How to print the following information with a single linux command line?
Hot to use a single linux command line in shell : Hot to use a single linux command line in shell to show the follwing information?
How to use a single line linux command line : How to use a single line linux command line in shell to print the following information?

Reviews

Write a Review

Business Management Questions & Answers

  In what way can knowledge of nonverbal communication help

In what way can knowledge of nonverbal communication help

  Terms of organizational behaviour

What is the attribution process in terms of organizational behaviour?

  Discuss about different storage devices

Discuss about different storage devices, how they are accessed (what protocols) and how to apply them to a storage design.

  Increase motivation for subordinates

Using the following format, apply one of the process models to explain why Carlos' effort might be so high

  Explain how marketing communications

Explain how marketing communications make products culturally relevant and What media schedule do you think would be suitable for the launch of a new sports car

  Find the financial statements for an openly traded company

Describe why (approximately 300 words) you would or would not invest in this company. Post a link to the financial statements with your initial post and include the company name in the subject line.

  Explain a negative self-talk experience

Explain a negative self-talk experience you've had. Looking back on it what could you have done differently?

  What are the main characteristics of born global firms

What are the main characteristics of born global firms? What drivers and causes of globalization have allowed born global firms

  Explain the fundamental challenges that organizations face

Explain the fundamental challenges that organizations face in general in regard to protecting organizational assets and information.

  Functional areas of business that you would like to focus

Discuss the few, one to three (1-3), functional areas of business that you would like to focus on as you progress through the business curriculum at Strayer University.

  Greater value for sunshine''s customers and prospects

Which web service/s do you think is/are critical to the launch of the Sunshine Publishing website, and why? Do you think Sunshine Publishing will generate more leads and sales from such a web site? How can help from outside service provide insu..

  Identifying and explaining factors that have led

Compare and contrast them by identifying and explaining factors that have led to their success or failure. And is there any case study that I can refer to?

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