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
raketka [301]
3 years ago
7

Write a function called calculate() that accepts three integer Numbers as arguments, compute these values : Sum and Product and

Return these computed results to the main program.
Computers and Technology
1 answer:
Dmitrij [34]3 years ago
5 0

Answer:

int* calculate(int a,int b,int c){

   int result[] = {0,0};

   int sum = a+b+c;

   int product = a*b*c;

   result[0] = sum;

   result[1] = product;

   return result;

}

Explanation:

The function is a block of the statement which performs the special task.

The function can return one integer, not more than one integer.

If we want to return multiple values then, we can use array.

we store the result in the array and return that array to the main function.

This is the only possible way to return multiple values.

So, define the function with return type array and declare the array with zero value.

Then, calculate the values and store in the variable after that, assign to the array.

Finally, return that array.  

You might be interested in
Write a program to declare a matrix A[][] of order (MXN) where ‘M’ is the number of rows and ‘N’ is the
Liula [17]

Answer:

import java.io.*;

import java.util.Arrays;

class Main {

   public static void main(String args[])

   throws IOException{

       // Set up keyboard input

       InputStreamReader in = new InputStreamReader(System.in);

       BufferedReader br = new BufferedReader(in);

 

       // Prompt for dimensions MxN of the matrix

       System.out.print("M = ");

       int m = Integer.parseInt(br.readLine());

       System.out.print("N = ");

       int n = Integer.parseInt(br.readLine());

       // Check if input is within bounds, exit if not

       if(m <= 2 || m >= 10 || n <= 2 || n >= 10){

           System.out.println("Matrix size out of range.");

           return;

       }

       // Declare the matrix as two-dimensional int array

       int a[][] = new int[m][n];

 

       // Prompt for values of the matrix elements

       System.out.println("Enter elements of matrix:");

       for(int i = 0; i < m; i++){

           for(int j = 0; j < n; j++){

               a[i][j] = Integer.parseInt(br.readLine());

           }

       }

       // Output the original matrix

       System.out.println("Original Matrix:");

       printMatrix(a);

       // Sort each row

       for(int i = 0; i < m; i++){

         Arrays.sort(a[i]);

       }

       // Print sorted matrix

       System.out.println("Matrix after sorting rows:");

       printMatrix(a);

   }

   // Print the matrix elements separated by tabs

   public static void printMatrix(int[][] a) {

       for(int i = 0; i < a.length; i++){

           for(int j = 0; j < a[i].length; j++)

               System.out.print(a[i][j] + "\t");

           System.out.println();

       }

   }

}

Explanation:

I fixed the mistake in the original code and put comments in to describe each section. The mistake was that the entire matrix was sorted, while only the individual rows needed to be sorted. This even simplifies the program. I also factored out a printMatrix() method because it is used twice.

4 0
3 years ago
You make an online purchase of a hooded sweatshirt with the logo of the Dallas Cowboys. The next time you log on, your screen ha
Novosadov [1.4K]

Answer:

c. data mining

Explanation:

Data mining can be defined as the term which is used for knowing the user preferences by using their previous search queries.  

Nowadays Data mining is being used by many companies to predict and show them the appropriate ads in front of them on the basis of their previous search queries.

so, according to the scenario, the most appropriate answer is option C.

8 0
3 years ago
UDP provides unreliable data transfer and therefore
vova2212 [387]

Answer: The answer is d.

Explanation:

UDP is a transport protocol (Layer 4 of the OSI model) that has no mechanism to provide a reliable transport between the source process and the destination one, as TCP does.

Anyway, due to this feature, is specially suitable for real-time applications , like video or audio, provided that the user can accept some loss in the stream.

Several real-time protocols, like RTP for instance (used for videoconferencing)  use UDP as transport protocol.

4 0
3 years ago
What is the difference of Information Technology to any other field of study?
Darya [45]

Answer:

The field of information technology, or IT, covers the support, administration, and design of telecommunications and computer systems. Some positions in this field include system analysts, software programmers, computer scientists, computer support specialists, and network and database administrators.

Explanation:

4 0
2 years ago
The rule of thumb that predicts that the number of transistors on a cpu will double every two years is called ________ law.
ivann1987 [24]
The rule of thumb that predicts that the number of transistors on a CPU will double every two years is called Moore's law.<span> The father of the Moore's law is Intel co-founder Gordon </span>Moore in 1965. This law states that <span>the number of transistors per square inch on integrated circuits had doubled every year since their invention.</span>
7 0
3 years ago
Other questions:
  • What is the only true way to wipe out every possibility of the virus?
    11·1 answer
  • QUESTION 1 Someone may choose to own a car instead of leasing because: AThe car can be resold later to make some money back. BTh
    9·1 answer
  • The Active Directory Users and Computers tool can be used to:______.
    11·1 answer
  • If a suspect is not read his or her Miranda rights, then nothing the suspect says can be used at trial, even if the suspect volu
    11·1 answer
  • Suzanne has inserted an image into her document and would like to adjust the color and contrast of the image.
    11·1 answer
  • What file extension is used to name a compressed folder
    10·1 answer
  • Write down a scratch program which:
    5·1 answer
  • When a program uses a ____, it reads all the records in the file from beginning to end, processing them one at a time. Group of
    5·1 answer
  • What is the size of BIOS?
    13·2 answers
  • Suppose you have 10 image files, each taking up 300 KB. About how many MB of space do they take up
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!