Algorithm for creating magic squares

Assignment Help Other Subject
Reference no: EM13254193

Input: Your program should ask the user to enter an odd integer. For the purposes of this program, treat the input as an unsigned short. Every odd number up to 999 is valid for this program. The program should continue prompting for numbers and printing magic squares until the user enters a zero. If an even number is entered, print an appropriate error message and prompt the user to enter another number.

Output: The program should output the magic squares to a text file. You don’t need to print the boxes around the numbers, but arrange the numbers in columns and rows so the square is readable using print formatting. In addition to the magic square, also print out the magic sum.

Miscellaneous: This program must use functions and arrays. It is your decision how many functions are used and how they are defined. There is an algorithm for creating magic squares; make sure you do your research before tackling this program.

Reference no: EM13254193

Questions Cloud

Compute the mass of each acid necessary : For each of the following acid-base reactions, calculate the mass (in grams) of each acid necessary to completely react with and neutralize 5.15 of the base.
Explain straight-line method of depreciation : Approximately one year later, the hospital is approached by Harmon Technology salesperson, Jane Black, who indicated that purchasing the scanner in 2011 from Faital Inc. was a mistake.
What is the induced emf between the wingtips : An airplane flies due north in a region where Earth's magnetic field has magnitude 5.3×10?5T, declination 0?, and inclination 75?. What's the induced emf between the wingtips, 36 m apart, when the plane flies at 230m/s
How many liters of chlorine gas can be obtained at 40c : How many liters of chlorine gas, Cl2, can be obtained at 40C and787 mmHg from 9.41 g of hydrogen chloride, HCl, according to the following equation 2KMnO4(s) + 16HCl(aq) à 8H2O(l) 2KCl(aq) 2MnCl2(aq) + 5Cl(g)
Algorithm for creating magic squares : This program must use functions and arrays. It is your decision how many functions are used and how they are defined. There is an algorithm for creating magic squares; make sure you do your research before tackling this program.
How does a transistor switch compare to a mechanical switch : How does a transistor switch compare to a mechanical switch In other words, a mechanical switch when it is ON has a zer impedance. What about the transistor switch
Find the average power delivered by the elevator motor : a 753 kg elevator starts from rest. it moves upward for 3.04 seconds with a constant acceleration until it reaches its cruising speed of 2.07 m/s
Define completely neutralize solution : a) how many millileters of 0.120MHCl are needed to completely neutralize 50.0mL of 0.101MBa(OH)2 solution.
Design a handheld hair dryer with the given specifications : Design a handheld hair dryer with the following specifications and realistic constraints: 1. It uses a 60 Hz, single-phase, 120 V r.m.s sinusoidal voltage source. 2. It has three settings low, medium, high.

Reviews

Write a Review

Other Subject Questions & Answers

  Ouestion on reliability and operational validity

A planner wants to assess road quality. He sends a questionnaire to a sample of residents and asks them to evaluate road surfaces, repair quality, and amount of traffic.

  What are the most common features of physical security

What are the most common features of physical security? What are the least common? How can extant features of a target environment be adapted for security purposes (such as for detection or asset protection)?

  Collect data on annual progress of student achievement

Annual Progress. How does your school setting collect data on annual progress of student achievement? (MSA Maryland State Assessment in March of each year in Reading/Math) Is the data collection of value? (Yes)Discuss why or why not.(It is of value i..

  Type of eclipse

Describe how the Sun looks during each type of eclipse and where is the Moon in relation to the Earth and the Sun during any solar eclipse?

  Describing dimensions of health

Define and explain each of the six dimensions of health: a. Physical Health b. Psychological Health c. Spiritual Health d. Social Health e. Intellectual Health f. Environmental Health

  Employers to lay off workers-lower wages and raise prices

advised employers to lay off workers, lower wages, and raise prices. asked businessmen to pledge not to lay off workers but instead to reduce working hours in order to equalize the sacrifice for all employees.

  Explain the importance of outdoor recreation in child lives

Explain the importance of outdoor recreation in the lives of both children and seniors Discuss the benefits of outdoor recreation for the local community. Use local examples to support your answer

  Transmitting the message in media

Campbell's soup has been promoted with television commercials, radio spots, newspaper coupons, and magazine advertisements. In the communication process, these media served as _____ for transmitting the message.

  Unmanned aerial vehicles

Unmanned aerial vehicles, also known as drones and lethal autonomous robotics, are seen by governments and companies as a great technological advantage to society. Drones are accurate means to gather intelligence and information, reconnaissance, and ..

  Strategic challenges with employees

You are a manager at a public organization, where you are responsible for supervising twenty employees. All these employees are experienced, and most have been transferred from other departments.

  Practice of professional psychology

Evaluate how legislative acts and case law decisions have directly influenced the practice of professional psychology. Use specific examples of both in your discussion.

  Process of briefing case

What information should I include and what format should I use for briefing a court case such as Shell v. R.W. Sturge, Ltd.?

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