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
almond37 [142]
3 years ago
9

Write a function that returns the largest value stored in anarray-of-int. Test the function in a simpleprogram.

Computers and Technology
1 answer:
Minchanka [31]3 years ago
3 0

<u>C program for finding the largest Value in array of integers</u>

#include <stdio.h>  

/*Function that returns the largest value stored in an array-of-int*/

int max(int array[], int m)  

{  

   int i;  

     /* Initializing variable maximum with array[0]*/

   int maximum = array[0];  

    /* Traversing array elements from 2 to last and comparing it with variable maximum*/

   for (i = 1; i < m; i++)  

       if (array[i] > maximum)  

           maximum = array[i];  

 

   return maximum; //returning maximum element of array

}  

//driver function  

int main()  

{  

   int array[] = {5, 78, 23, 65, 9}; //Input array

   int m = sizeof(array)/sizeof(array[0]); //finding the length of array

   printf("Largest in given array is %d", max(array, m));/*function calling and printing maximum element of array */

   return 0;  

}

<u>Output: </u>

Largest in given array is 78

You might be interested in
What does the gravity setting of a jump control?
Vikki [24]

Answer:

A

Explanation:

3 0
3 years ago
Boole’s theories of logic set the foundation for what aspect of computing today?
AlekseyPX

Answer:

Software aspect of computing

Explanation:

Boole never regarded logic as a branch of mathematics, instead, he proposed that logical propositions should be expressed as algebraic equations. Mathematical operations were replaced with AND, OR.

Boolean algebra provides the basis for analyzing the validity of logical propositions because it captures the two-valued character (binary:  (1 or 0) ) of statements that may be either true or false which is very important for all digital computation of which softwares are part of.

7 0
3 years ago
What does it mean to “declare a variable”? create a variable use a variable share a variable modify a variable
lara [203]

You are defining the variable

6 0
3 years ago
Read 2 more answers
A stateful inspection firewall ________. select one:
mart [117]

;) https://quizlet.com/7016715/cyber-security-flash-cards/ go check the link

6 0
3 years ago
Write one for loop to print out each element of the list several things. then write another for loop
Kay [80]

Question:

Write one for loop to print out each element of the list several_things. Then, write another for loop to print out the TYPE of each element of the list several_things.

Answer:

The solution in python is as follows:

for element in several_things:

    print(element)

   

for element in several_things:

    print(type(element))

Explanation:

The solution assumes that the list several_things has already been initialized.

So, the rest of the code is explained as follows:

This line iterates through the list, several_things

for element in several_things:

This line prints each element

    print(element)

This line iterates through the list, several_things for the second time    

for element in several_things:

This line prints the type of each element

    print(type(element))

6 0
3 years ago
Other questions:
  • Which statement is an example of an opinion from an online source?
    14·2 answers
  • Write a program that reads a number in feet, converts it to meters, and displays the result. One foot is 0.305 meters. INPUT and
    8·1 answer
  • When advising a customer on the purchase of a new power supply, you should explain that if the power supply runs at peak perform
    9·1 answer
  • Error: 404 Not Found <br>The resource that you requested does not exist on this server.
    14·2 answers
  • Which workplace trend are outsourcing and telecommuting are examples of? Please select the best answer from the choices provided
    13·2 answers
  • Which of the following statement is correct ? A . potential difference is measured by ammeter . B . The unit of potential differ
    9·1 answer
  • Hadley made a plan that after downloading the Eclipse IDE, she would disable her security program, extract and install Eclipse,
    10·1 answer
  • Classify computer software and write short note about it ?​
    6·1 answer
  • Where are my files shortcut in documents folder.
    14·1 answer
  • Identify the places in the code where there are object-oriented concept violations, content coupling, common coupling, control c
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!