Lo Shu Magic Square
The Lo Shu Magic Square is a grid with three rows and three columns that has the following properties:
• The grid contains the numbers 1 through 9 exactly.
• The sum of each row, each column, and each diagonal all add up to the same number. This is shown in Figure 8-18.
Figure 8-18
Write a
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Starting Out With C++: Early Objects (10th Edition)
Additional Engineering Textbook Solutions
Modern Database Management
C Programming Language
Java How To Program (Early Objects)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Artificial Intelligence: A Modern Approach
- (Electrical eng.) a. An engineer has constructed a two-dimensional array of real numbers with three rows and five columns. This array currently contains test voltages of an amplifier. Write a C++ program that interactively inputs 15 array values, and then determines the total number of voltages in these ranges: less than 60, greater than or equal to 60 and less than 70, greater than or equal to 70 and less than 80, greater than or equal to 80 and less than 90, and greater than or equal to 90. b. Entering 15 voltages each time the program written for Exercise 7a runs is cumbersome. What method could be used for initializing the array during the testing phase? c. How might the program you wrote for Exercise 7a be modified to include the case of no voltage being present? That is, what voltage could be used to indicate an invalid voltage, and how would your program have to be modified to exclude counting such a voltage?arrow_forward(Numerical) Write and test a function that returns the position of the largest and smallest values in an array of double-precision numbers.arrow_forwardProblem2: 2D Arrays Define a 2D array using Java code that takes from a teacher the total number of rows and the total number of columns. Then let the teacher fill the array by students IDs and courses marks for each student. And print the following: 1- Print the array. 2- Print the marks that are less than 50 (mark < 50)arrow_forward
- JAVA PROGRAM: Monkey Business A local zoo wants to keep track of how many pounds of food each of its three monkeys eats each day during a typical week. Write a program that stores this information in a two-dimensional 3 × 5 array, where each row represents a different monkey and each column represents a different day of the week. The program should first have the user input the data for each monkey, or use constant values rather than asking user for input. Then it should create a report that includes the following information: Display 3X5 array first. Average amount of food eaten per day by the whole family of The least amount of food eaten during the week by any one The greatest amount of food eaten during the week by any one Input Validation: Do not accept negative numbers for pounds of food eaten.arrow_forwardSee the sample outputs for more clarification. Project Specifications Input for this project: Values of the grid (row by row) Output for this project: Whether or not the grid is magic square Programmer's full name Project number Project due date Processing Requirements Use the following template to start your project: #include using namespace std; // Global constants // The number of rows in the array // The number of columns in the array // The value of the smallest number // The value of the largest number const int ROWS = 3; const int COLS = 3; const int MIN = 1; const int MAX = 9; // Function prototypes bool isMagicsquare(int arrayRow1[], int arrayRow2 [], int arrayRow3[], int size); bool checkRange (int arrayRow1[], int arrayRow2[], int arrayRow3[], int size, int min, int max); bool checkUnique(int arrayRow1[], int arrayRow2[], int arrayRow3[], int size); bool checkRowSum (int arrayrow1[], int arrayrow2[], int arrayrow3[], int size); bool checkColiSum(int arrayrow1[], int…arrow_forwardPass by Array Create a JAVA program that will ask the user to enter ten numbers and get the sum of all odd numbers. The numbers will be stored in array The array value will be pass as argument to the functionarrow_forward
- programming used: javaarrow_forwardmatlab codearrow_forwardLo Shu Magic Square C++ The Lo Shu Magic Square is a grid with 3 rows and 3 columns. The Lo Shu Magic Square has the following properties: The grid contains the numbers 1 through 9, each cell is unique. The sum of each row, each column, and each diagonal all add up to the same number. Write a program that creates a 2D array of size 3x3, and fills each cell withn random, unique values betweem 1 and 9. Print the values. Determine if the 2D array is a Lo Shu Magic Square and print the results. Sample Output Run the program when the 2D array is a lo shu square. A couple runs of the program where it is NOT a Lo Shu Magic Square. The program declares and initializes a 2D array of size 3,3 and fills it with random, unique values. The program prints the values correctly. The program determines whether or not the 2D array is a Lo Shu Magic Square and prints the results. The program must use at least one function besides main for credit.arrow_forward
- AnayAnp lava Appiation C npoonpl yAop oova Appiraion Cehehpoaluginundnma ole Write a Java program that obtains products' numbers (array named productsI), and allows the user to perform array's operations using the following methods: initializeArray() - to initialize the array's elements printArray()- to print array's elements searchArray()- to search and determine if a product exists in the array removeArray()- to remove an array element and display the new array The program also includes: 1. One class named ArrayOperations 2. One instance variable named size Your program should include the following code statements in the ArrayApp class: Aryoperstions jevaa "Araylop java import javax. sking. J0ptionPane, 3 public clas ArrayApp { public static void main(String 1 args) { Arryoperations obj - new Arryoperations(); obj.initializeArray(); obj.printárray(); int searcho - Integer 19 he hi porseInt(J0ptionPane.showInputDialog("Do you want to search for a product 1- Yes, 2- No")): if (searchQ…arrow_forwardIn C++Monkey Business A local zoo wants to keep track of how many pounds of food each of its three monkeys eats each day during a typical week. Write a program that stores this information in a two-dimensional 3 × 5 array, where each row represents a different monkey, and each column represents a different day of the week. The program should first have the user input the data for each monkey. Then, it should create a report that includes the following information: Average amount of food eaten per day by the whole family of monkeys. The least amount of food eaten during the week by any one monkey. The greatest amount of food eaten during the week by any one monkey. Write functions: average() least() greatest() main()arrow_forward- Transposed matrixImplement a program that calculates the transpose of a matrix entered by the user.- Conway's Game of LifeCreates a simulation of Conway's Game of Life in a 10x10 matrix, where the initial state is entered by the user.do it in "c" programming languagearrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,