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
vagabundo [1.1K]
3 years ago
13

Write a C program that stores N random numbers in an array named rA[ ] and determine the largest, smallest, and average values o

f this array. Display the array elements that store these values. The random numbers range from -50 to +50. N is a command line argument.
Computers and Technology
1 answer:
Aliun [14]3 years ago
4 0

Answer:

// program in C.

// headers

#include <stdio.h>

// headers

#include <stdlib.h>

// headers

#include <limits.h>

// main function

int main(int argc, char** argv)

{

   // read value of N from command line arguments

   int N=atoi(argv[1]);

   // variables

   int max=INT_MIN;

   // variable

   int min=INT_MAX;

int rA[N],i;

// fill the array with random number

for(i=0;i<N;i++)

{

    // generate random number from -50 to +50

    rA[i]=rand()%101-50;

    // find the Maximum

    if(rA[i]>max)

    max=rA[i];

    // find the Minimum

    if(rA[i]<min)

    min=rA[i];

}

// print values of array

printf("values of the array are:");

for(i=0;i<N;i++)

{

    printf("%d ",rA[i]);

}

// print Maximum

printf("\nMaximum value is:%d",max);

// print Minimum

printf("\nMinimum value is:%d",min);

return 0;

}

Explanation:

Read value of N from command line.Then create an array of size N.Fill the array with random number from -50 to +50.Then find the Maximum of all the elements and  assign it to variable "max" and find Minimum from all and assign it to variable "min". then print all the elements of the array, Minimum and Maximum.

Output:

command line argument=10

values of the array are:-18 -18 4 -38 2 6 -42 -20 -6 44 -6 -11 15 -31 1                                                    

Maximum value is:44                                                                                                        

Minimum value is:-42

You might be interested in
What are the names of the components (each shown with a leader and a line) of a circuit shown in the diagram?
Goryan [66]

Answer:

The name of the components of the given labelled circuit is:

The box like figure in the given image is the battery source from where the current drawn into the circuit.

A string connecting positive terminal of battery to the bulb is an electric wire through which current flows in the circuit.

A bubble like object in the circuit is a bulb which lights up when current moves through the circuit.

A component connected to the negative terminal of batter source is a switch.

Then open circuit is an open as the key of the switch is open.

8 0
3 years ago
Ranges of IP address that anyone can use for their internal networks are known as ______.
Rama09 [41]
Since no answer choices, have to deduce it is Private Networks
8 0
3 years ago
Read 2 more answers
Imagine that you have an image that is too dark or too bright. Describe how you would alter the RGB settings to brighten or dark
ratelena [41]
Turn the brightness up
7 0
2 years ago
Concept of community forest contributes in the field of health population and environment. <br>​
Lisa [10]

The correct answer to this open question is the following.

Although there are no options attached we can say the following.

The concept of community forest contributes to the field of health population and environment in that it helps forest communities to preserve their homes, farm fields, and cattle because they depend on nature to produce the crops or food that sell or trade.

Community forests help these people to take care of nature and protect the environment because they depend so much on the forest to get fresh water, fresh air, and the proper natural resources to live.

People who live in community forests have the utmost respect for nature and do not try to exploit it to benefit from natural resources or raw materials as corporations do.

So together, community forest aims to preserve and protect the natural resources and the conservation of the wildlife and the flora of these places.

4 0
3 years ago
Which software is designed to prevent malicious software from accessing your computer?
Mandarinka [93]
In what way might i ask?
Either its
Firewalls
Anti-virus
Anti-malware
Anti-Randsomware 
Either one
7 0
3 years ago
Other questions:
  • 1) what are two functions of a pick or count condition?
    5·1 answer
  • Write a while statement that prints all even numbers between 1 and 100 to the screen.
    6·1 answer
  • Sofia is reading a difficult text for class and worries that she won't complete it by the given deadline. How can a text-
    13·2 answers
  • 3. By default, Blender® remembers your last 32 actions and allows you to undo them one at a time by pressing CTRL+Z. (1 point)
    9·1 answer
  • In a graphical user interface, which is a small symbol on the screen whose location and shape changes as a user moves a pointing
    10·1 answer
  • Look at the four schematic symbols shown in the figure above. Each of the symbols is labeled with a number. Which of the followi
    11·1 answer
  • Hat is the purpose of the domain name?
    7·2 answers
  • ​________________________ are the main forms of direct and digital marketing. A. Mobile​ marketing, social media​ marketing, and
    5·1 answer
  • It specifies the amount of memory needed to store data.
    7·2 answers
  • Which of the following is typiacally the last step of the mail merge process
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!