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 does nitro type teach? What lessons do we learn from it? Explain your answer.
Molodets [167]

Answer:

it teaches how to type and not get mad over it

Explanation:

I love nitro type it makes me feal like i know how to type

6 0
3 years ago
Read 2 more answers
Which two related organizations are responsible for managing the top-level domain name space and the root domain name system (dn
juin [17]

I guess the correct answers are,

IANA (Internet Assigned Numbers Authority)

ICANN (Internet Corporation for Assigned Names and Numbers)

Thе Intеrnеt Assignеd Numbеrs Authοrity (IANA) is a functiοn οf, a nοnprοfit privatе Amеrican cοrpοratiοn that οvеrsееs glοbal IP addrеss allοcatiοn, autοnοmοus systеm numbеr allοcatiοn, rοοt zοnе managеmеnt in thе Dοmain Namе Systеm (DNS), mеdia typеs, and οthеr Intеrnеt Prοtοcοl-rеlatеd symbοls and Intеrnеt numbеrs.

Thе Intеrnеt Cοrpοratiοn fοr Assignеd Namеs and Numbеrs (ICANN /ˈaɪkæn/ ЕYЕ-kan) is a nοnprοfit οrganizatiοn rеspοnsiblе fοr cοοrdinating thе maintеnancе and prοcеdurеs οf sеvеral databasеs rеlatеd tο thе namеspacеs and numеrical spacеs οf thеIntеrnеt, еnsuring thе nеtwοrk's stablе and sеcurе οpеratiοn.

6 0
3 years ago
What are the two contextual tabs that appear when working with PivotTables?
Nutka1998 [239]

Answer:

<u>D.Analyze and Design</u>

8 0
3 years ago
Read 2 more answers
Im stuck on thiss for the longesttt
fiasKO [112]

Answer:

i cant understand?,

Explanation:

i know its a sort of coding game but what is the goal of the game/task?

3 0
2 years ago
Assume that a function named swapdoubles has been defined and is available for use in this exercise: that function receives two
Romashka-Z-Leto [24]

Answer:

The function is given as follows;

void sort3 (double &a, double &b, double &c){

if (a>b) swapdoubles (a,b);

if (b>c) swapdoubles (b,c);

if (a>b) swapdoubles (a,b);

}

Explanation:

4 0
4 years ago
Other questions:
  • When typing in a cell, hitting Tab will bring which result?
    12·2 answers
  • PLEASE HELP. I NEED ASAP!!
    13·2 answers
  • Five indicators of computer illiteracy​
    13·1 answer
  • Describe the use of technology in the promotional function
    5·2 answers
  • Why does it still say I am ambitious whenever I have the 5 brainliest and almost 700 points?
    15·2 answers
  • WILL MARK BRAINIEST
    12·1 answer
  • Select the best answer that completes the following sentences. Wireless technology changed the workday to
    6·2 answers
  • Some people worry that there won’t be enough jobs in the future because computers will be able to do everything better than peop
    7·2 answers
  • What was the term, “cyberspace,” originally used to describe?
    6·1 answer
  • After a group sets a project schedule, members should be prepared to
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!