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
galina1969 [7]
3 years ago
8

1. Write a program that declares an array named alpha with 50 components of the type double. Initialize the array so that the fi

rst 25 components are equal to the square of the counter (or index) variable and the last 25 components are equal to three times the index variable. 2. Output the array so that exactly ten elements per line are printed. 3. Run your program again, but this time change the code so that the array is filled with random numbers between 1 and 100. 4. Write the code that computes and prints the average of elements of the array. 5. Write the code that that prints out how many of the elements are EXACTLY equal to 100.
Computers and Technology
1 answer:
Aleksandr [31]3 years ago
8 0

Answer:

Explanation:

1. Write a program that declares an array named alpha with 50 components of the type double. Initialize the array so that the first 25 components are equal to the square of the counter (or index) variable and the last 25 components are equal to three times the index variable.  

  double alpha[50];

   for (int i=0;i<25;i++)

   {

       alpha[i]=i*i;

       alpha[i+25]=(i+25)*3;

  }

2. Output the array so that exactly ten elements per line are printed.  

   for (int i=0;i<50;i++)

   {

       cout<<i+1<<". "<<alpha[i]<<" ";

       if (((i+1)%10)==0)

       {

           cout<<endl;

       }

   }

3. Run your program again, but this time change the code so that the array is filled with random numbers between 1 and 100.  

   double alpha[50];

   for (int i=0;i<50;i++)

   {

       alpha[i]=rand()%101;

   }

   for (int i=0;i<50;i++)

   {

       cout<<i+1<<". "<<alpha[i]<<" ";

       if (((i+1)%10)==0)

       {

           cout<<endl;

       }

   }

4. Write the code that computes and prints the average of elements of the array.  

   double alpha[50],temp=0;

   for (int i=0;i<50;i++)

   {

       alpha[i]=rand()%101;

       temp+=alpha[i];

   }

   cout<<"Average :"<<(temp/50);

5. Write the code that that prints out how many of the elements are EXACTLY equal to 100.

   double alpha[50],temp=0;

   for (int i=0;i<50;i++)

   {

       alpha[i]=rand()%101;

       if(alpha[i]==100)

       {

           temp++;

       }

   }

   cout<<"Elements Exacctly 100 :"<<temp;

Please note:  If you put  each of above code to the place below comment  it will run perfectly after compiling

#include <iostream>

using namespace std;

int main()

{

   // If you put  each of above code here it will run perfectly after compiling

   return 0;

}

You might be interested in
Complete the statement using the correct term.
vladimir1956 [14]

The BODY of the site is what will be displayed on the web page. It contains most of the distinctive content of the web page.

A web page refers to a document exhibited by the browser, which is generally written in the HTML language.

The body of a web page is a big area in the center that contains the most important and distinctive content of a web page.

The body will determine the central content of the HTML document, which will be observable on the web page (e.g., a photo gallery).

Learn more about a web page here:

brainly.com/question/16515023

5 0
3 years ago
Please answer this correctly what’s the answer opening modify style dialog box enables you to
Aloiza [94]
The answer is all of the above
4 0
4 years ago
why does this site force you to make an account to get literally anything at all i want to pass the 9th grade not watch 5 ads pe
cricket20 [7]

Answer:

They do anything for money sis

Explanation:

4 0
4 years ago
What is meant by authorization? The decision to allow or deny a subject access to an object. The ability of a subject and an obj
USPshnik [31]

Answer: <em>The ability of a subject and an object to interact.</em>

Explanation:

Authorization is known as or referred to as a security mechanism that is used in order to determine the client/user access or privileges levels that are related to the system resources these mostly tend to include computer services, programs, files, data and other application. Authorization is also referred to as something that is preceded by authentication i.e for individuals identity verification.

6 0
3 years ago
A file that is embedded on the hard drive of a computer, often without a person's knowledge, that collects and stores informatio
Gnom [1K]
The correct answer would be Spyware
6 0
3 years ago
Other questions:
  • There are many careers within the IT industry. _____ are responsible for organizing a company's data, making sure all the data i
    9·1 answer
  • . When a system isdelivered over time, with each delivery (release) adding tothe
    5·1 answer
  • _________ Code that you write is called primary code, and code that the compiler produces after processing the primary code is c
    14·1 answer
  • There is only one way to change line spacing in Word.
    14·1 answer
  • Select the correct answer. Adrian sent his manager Stacy an email message that required her immediate attention. Stacy was unabl
    7·2 answers
  • The elements in a long array of integers are roughly sorted in decreasing order. No more than 5 percent of the elements are out
    12·1 answer
  • Please help ASAP!
    15·1 answer
  • Preventive security has which of the following advantages over reactive security:
    10·1 answer
  • What are programs that are installed without the user knowing
    7·1 answer
  • How many basic elements of QBASIC are there
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!