1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
insens350 [35]
3 years ago
9

What is the printout (display) of the following program? public class Test { public static void main(String[] args) { int[][] va

lues = {3, 4, 5, 1}, {33, 6, 1, 2}; int v = values[0][0]; for (int row = 0; row < values.length; row++) for (int column = 0; column < values[row].length; column++) if (v < values[row][column]) v = values[row][column]; System.out.print(v); } }
Computers and Technology
1 answer:
vodka [1.7K]3 years ago
8 0

Answer:

The printout of the program is 33

Explanation:

Given the code as follows:

  1.        int[][] values = {{3, 4, 5, 1}, {33, 6, 1, 2}};
  2.        int v = values[0][0];
  3.        for (int row = 0; row < values.length; row++)
  4.            for (int column = 0; column < values[row].length; column++)
  5.                if (v < values[row][column])
  6.                    v = values[row][column];
  7.                System.out.print(v);

The code above will find the largest value from the two-dimensional array and print it out.

The logic of finding the largest value is as follows:

  • Create a variable, <em>v</em>, to hold the largest number (Line 2). At the first beginning, we simply set the value from the first row and first column (values[0][0])  as our current largest value.
  • Next, we need to compare our current largest value against the rest of the elements in the two dimensional array.
  • To make the comparison, we need a two-layers for loops that will traverse through every row and column of the array and compare each of the element with the current largest value (Line 3-6).
  • If the current largest value, v, is smaller than any element of the array, update the <em>v</em>  to the latest found largest value (Line 5-6).
  • After completion of the for-loop, the v will hold the largest number and the program will print it out (Line 8).
You might be interested in
4. What are five actions you should do to care for your camera?
den301095 [7]
Adding to the one above,
Keep food or drinks away from the camera
7 0
3 years ago
Ingredient Adjuster
Semenov [28]

Answer:

#include <iostream>

using namespace std;

int main(){

float cookies=0;

float sugar=1.5;

float butter=1;

float flour=2.75;

cout<<"how many cookies do you want: "<<endl;

cin>>cookies;

float num = cookies/48;

cout<<num<<endl;

cout<< "to make " << cookies<<"cookies you need: "<<endl;

cout<<"sugar cups: "<<num*sugar<<endl;

cout<<"butter cups: "<<num*butter<<endl;

cout<<"flour cups: "<<num*flour<<endl;

return 0;

}

7 0
2 years ago
The blank one is a close up of what logo?
fredd [130]

Answer:

These are company brand logo

Explanation:

These are company brand logo, and you will find it on all products of that company, plus generally you will find them on each page of their website as well as mobile application.

6 0
3 years ago
Many web pages today use ____ —small text files that are stored on your hard drive by a web server, typically the one associated
elena-14-01-66 [18.8K]
The data of the webpages on the Internet are commonly stored into hard drives from servers around the world. These supercomputers have the capability to store huge chunks of data just to keep the web page from running. The HTTP protocol is the one that allows for these servers to store data.
3 0
3 years ago
Read 2 more answers
Write a function called random_marks. random_marks should #take three parameters, all integers. It should return a #string. # #T
Damm [24]

Answer:

Explanation:

The following code is written in Java. It creates the function random_marks as requested. It uses three for loops to go concatenating the correct number of apostrophes, quotes, and pairs to the output string before returning it to the user. A test case was added in main and the output can be seen in the attached picture below.

class Brainly {

   public static void main(String[] args) {

       String output = random_marks(3,2,3);

       System.out.println(output);

   }

   public static String random_marks(int apostrophe, int quotes, int pairs) {

       String output = "";

       for (int x = 0; x < apostrophe; x++) {

           output += '\'';

       }

       for (int x = 0; x < quotes; x++) {

           output += '\"';

       }

       for (int x = 0; x < pairs; x++) {

           output += "\'\"";

       }

       return output;

   }

}

4 0
2 years ago
Other questions:
  • Write down a recurrence relation for this version of QuickSort, and solve it asymp-totically. Show your work. Assume that the ti
    13·1 answer
  • During World War II, the Battle of the Coral Sea was significant because it evened the naval strength of the Japanese and US fle
    6·1 answer
  • Question # 4
    8·2 answers
  • We have a 16 GB main memory and 256 MB fully-associative cache, with block size of 64 bytes. We wish to store a 6 x 6 matrix in
    5·1 answer
  • Clunker Motors Inc. is recalling all vehicles in its Extravagant line from model years 1999-2002 as well all vehicles in its Guz
    9·1 answer
  • p25: File Write and Read1) User enters a file name (such as "myMovies.txt").2) User enters the titles of 4 of their favorite mov
    12·1 answer
  • Simone needs to add a query for multiple tables in her database. She is using Access 2016. Which tab should she use to add the q
    5·1 answer
  • Look at the following partial class definition, and then respond to the questions that follow it:
    12·1 answer
  • I will give brainliest to the best answer. what is a good screen recorder
    11·1 answer
  • webrooming is when consumers physically inspect a product in a store to get a look and feel for it—and then buy it from an onlin
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!