subject

If numbers is a two-dimensional int array that has been initialized and total is an int that has been set to 0, which of the following will sum all the elements in the array?
1.for (int row = 0; row < numbers. length; row++) { for (int col = 0; col < numbers[row].length; col++) total += numbers[row][col]; }
2.for (int row = 0; row < numbers[row].length; row++) { for (int col = 0; col < numbers. length; col++) total += numbers[row][col]; }
3.for (int row = 1; row < numbers. length; row++) { for (int col = 1; col < numbers. length; col++) total += numbers[row][col]; }
4.for (int row = 0; row < numbers. length; row++) { for (int col = 0; col < numbers. length; col++) total += numbers[row][col]; }

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 01:00
Petrică, tânăr licean în clasa a ix-a, a primit în dar de la părinţii săi un cont bancar pentru micile sale cheltuieli curente. el este pasionat de internet banking şi îşi verifică cu grijă toate tranzacţiile efectuate. pentru creşterea securităţii tranzacţiilor online, banca îi furnizează lui petrică un număr pe care el va trebui să îl modifice, obţinând un număr tan – număr de autentificare a tranzacţiei (transaction authentication number). regula de obţinere a numărului tan este următoarea: se formează cel mai mic număr par din toate cifrele numărului furnizat de bancă. cerinţă cunoscând numărul n furnizat de bancă, să se determine numărul tan obţinut de petrică. date de intrare fişierul tan.in conţine pe prima linie numărul natural n cu semnificaţia din enunţ. date de ieşire fişierul de ieşire tan.out va conţine o singură linie pe care va fi scris numărul tan cerut. restricţii • 0 < n < 18*1018 • n are cel puţin o cifră pară • numărul tan obţinut nu poate conţine zerouri nesemnificative
Answers: 2
question
Computers and Technology, 23.06.2019 01:10
Are special combinations of keys that tell a computer to perform a command. keypads multi-keys combinations shortcuts
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
Who can provide you with a new password when you have forgotten your old one? your provide you with a new password in case you forget your old one.
Answers: 3
question
Computers and Technology, 23.06.2019 13:00
Which of the following statements is false? a. a class can directly inherit from class object. b. if the class you're inheriting from declares instance variables as private, the inherited class can access those instance variables directly. c. a class's instance variables are normally declared private to enforce good software engineering. d. it's often much more efficient to create a class by inheriting from a similar class than to create the class by writing every line of code the new class requires.
Answers: 3
You know the right answer?
If numbers is a two-dimensional int array that has been initialized and total is an int that has bee...
Questions
question
Mathematics, 10.05.2021 19:20
question
Mathematics, 10.05.2021 19:20
question
Mathematics, 10.05.2021 19:20