Concept explainers
(Game: find the flipped cell) Suppose you are given a 6-by-6 matrix filled with 0s and 1s. All rows and all columns have an even number of 1s. Let the user flip one cell (i.e., flip from 1 to 0 or from 0 to 1) and write a
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Additional Engineering Textbook Solutions
Web Development and Design Foundations with HTML5 (8th Edition)
Modern Database Management
Java: An Introduction to Problem Solving and Programming (7th Edition)
Starting Out with Python (4th Edition)
Starting Out with C++: Early Objects (9th Edition)
Concepts Of Programming Languages
- Write a program for reading a square matrix (A) 10,10, then calculate and find the following: 1- the sum of the elements of the upper triangle of the matrix. 2 - The sum of the elements of the lower triangle. 3- The sum of the main diagonal elements of the matrix. 4- The sum of the elements of the perimeter of a matrix.arrow_forwardi. Creates a matrix using: B=rand (20) a-write a program to find all numbers less than or equal 0.5 and put them in a new matrix with dimension 20x10. you can extend with zeros to fill the matrix. b- Do same as point a for all numbers above 0.5. c- Count all the numbers less or equal 0.3 , the numbers between 0.3 and 0.7 and count the numbers more than or equal 0.7.Put the results in a new vector with dimension 3x1. d- Replace the numbers of between 0.7 and 0.9 with 1. e- Add all the elements column wise.arrow_forwardProgram thisarrow_forward
- (Compute total marks for each student) Suppose the marks obtained by all students are stored ina two-dimensional array. Each row records a student’s marks for five tests. For example, the followingarray stores the test marks for eight students. Write a program that displays students and the totalmarks they obtained in five tests, in decreasing order of the total marks.arrow_forwardProblem Description - JAVA PROGRAMMING Use a Two-dimensional (3x3) array to solve the following problem: Write an application that inputs nine numbers, each of which is between 1 and 10, inclusive. Display the array after the user inputs each value. Rotate/flip the array by changing places. Make the rows columns and vice versa. You have to move the elements to their new locations. Remember to validate the input and display an error message if the user inputs invalid data. Documentation and the screenshot(s) of the results. Example: 1 2 3 4 5 6 7 8 9 the result will be : 1 4 7 2 5 8 3 6 9arrow_forwardThe following program is supposed to let the end-user enters 10 numbers in a one dimensional array. The program must then check the input numbers in the following order and way: 1f the input number is a negative one, the program should multiply that number by (5), and return the number of negative elements in the array. 2. if the input number is a positive one, the program should multiply that number by (2), and return the number of positive elements in the array. 3. if the input number is a zero, the program should return the number of zeros in the array The program code is given below with some missing code. You are required to write the missing code ONLY in order to make the program complete. Sample Input/Output Enter 10 numbers in the array -8 -16 16 80 2 12 -12 -2 0 -40 -80 32 16 0 4 24 -60 -10 0 The number of negative elements is: 4 The number of positive elements is: 4 The number of zeros is: 2 dinclude using namespace std; int main() int input[10], i, negative-0, positive-0,…arrow_forward
- Q2: Write a C# program that read an array A(4x4) of float numbers, and do the following: 1- Print the average of prime numbers in the overall array. 2- Print the summation of odd numbers in the even column and even numbers in the odd row. 3- Replace the first row with the last row and print the new array row by row. Don't use class or functions.arrow_forwardit are given a array arr = {1,2,3,4,5,6,7,8,9,16}., ++.Given the elements in first half of the array. ven array will have only even number of elements. (TRarrow_forwardJava Program - Functions with 2D Arrays Write a function named displayElements that takes a two-dimensional array, the size of its rows and columns, then prints every element of a two-dimensional array. Separate every row by a new line and every column by a space. In the main function, write a program that asks for integer input to be assigned on a 3 x 3 array and call the function displayElements to print the contents on the next line. Input 1. Multiple lines containing integer each line Output R1C1: 1 R1C2: 2 R1C3: 3 R2C1: 4 R2C2: 5 R2C3: 6 R3C1: 7 R3C2: 8 R3C3: 9 1 2 3 4 5 6 7 8 9arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT