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
Hello can you please help with this if you want to thank you!
nikklg [1K]

Answer:

hardware and software is the answer

8 0
3 years ago
Read 2 more answers
Need help please will mark brainliest
aleksklad [387]

Answer:

intranet

Explanation:

An intranet is a private network that you can't access outside the physical boundary of an organization

7 0
3 years ago
A speaker says:
vichka [17]

Answer:

B)

Explanation:

8 0
3 years ago
How would GIS, GPS, or remote sensing technology be used to evaluate the destruction caused by a tornado in Oklahoma?
emmainna [20.7K]

Answer:

They can be used to compare a certain region before and after disaster.

Explanation:

4 0
3 years ago
All of the following are U.S.-EU data privacy requirements except:
Montano1993 [528]

Answer:

b. Redundant hardware and data backup systems

Explanation:

Data privacy is important where a company collects, processes and stores personal information.In the US-EU have laid down regulations to ensure data privacy is maintained. It is a requirement before collection of personal data, to clearly state why the data is being collected and how it will be used.The individuals whose data is being processed have a right to access their data at no cost during processing . Of great importance is the security of the data so as to maintain its integrity, Companies are required to take steps in protecting the data from unauthorized access, processing and accidental loss.redundant hardware and data backup system are used by companies as a fail-safe mechanism in data protection but they are not a requirement in data privacy, although they enhance it.

8 0
3 years ago
Other questions:
  • The mouse and keyboard are also sometimes called
    5·1 answer
  • Smartphones store their operating system software in ________.
    11·1 answer
  • you just bought a new hard drive for your computer, you plan to use this secondary hard drive to store all school work files. on
    13·1 answer
  • If you were investigating login issues on a Windows computer, which portion of the Event Viewer logs would be a good place to st
    7·1 answer
  • in python Write a loop that counts the number of lowercase characters that appear in the string referenced by mystring.
    11·1 answer
  • OH GOD PLEASE HELP I CAN'T FIGURE THIS OUT-
    6·1 answer
  • RTOS stands for ______ Time Operating System.
    11·1 answer
  • If you want to change your system settings, what should you use
    5·1 answer
  • Please help ⊙﹏⊙ thank you &lt;3
    10·2 answers
  • List two examples of semiconductor materials​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!