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
Can someone pelaseee help
aalyn [17]

Answer:

Explanation:

develloppemetn de grace en option est logiquement une biologiste experimenter des annes 1256 a toulouse en france

6 0
2 years ago
Write the code to compute and output how many times the value 99 is found in an array of integers named numbers
astraxan [27]
Thank you for being the rare question where you actually provide what language you want your answer in; I approve, and encourage this.

In Java, the following will work.
I made it a bit more versatile to work with others numbers, other than 99, if you so please (if not, just hardcode the 99 in yourself).

// Example list - fill this with numbers yourself.
ArrayList<Integer> nums = new ArrayList<>();
int n = 99;
int count = (int)nums.stream().filter(i -> i == n).count();
System.out.println(n + " occurences.");
8 0
3 years ago
11.5 Code Practice edhesive
Tatiana [17]

Answer:

<html>

<body>

<p style="text-align:center;color:red;">This is a paragraph.</p>

<p><i> "This text is italic</i></p>

</body>

</html>

Explanation:

I got a 75%. Hope this helps.°ω°

8 0
3 years ago
Read 2 more answers
Which of the following solutions enables simultaneous digital transmission of voice, video, data, and other network services ove
Annette [7]

Answer:

3. ISDN

Explanation:

ISDN ( Integrated Services Digital Network  ) -

It is the used for the simultaneous digital transmission of network service , data , video and voice , instead of the old circuits of the public switched telephone network ( PSTN ) , is referred to as ISDN .

The characteristic feature of ISDN is that it integrates the data and speech on the same lines , which is not possible in PSTN .

Hence, from the given information of the question,

The correct option is ISDN .

8 0
2 years ago
What do we call the distribution and access of illegal copies of digital books??
Maru [420]
That concept is piracy


3 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following tasks is least effective at preventing a computer virus?
    14·2 answers
  • List and explain the error in the code
    14·1 answer
  • In every organization, workers receive and sendinformation daily. The flow of this information should be____________.upward and
    11·1 answer
  • How does a linear algorithm perform compared to a quadratic one on our imaginary race track?
    5·1 answer
  • How should a Salesforce Admin fulfill those requirements? Universal Containers launches a Partner Community for their resellers
    13·1 answer
  • Video is a medium that's looks real anyways, but is real________________.
    10·1 answer
  • In a networking context, "architecture" refers to
    5·1 answer
  • Some people recommend deleting social media accounts because of the troubling legal and ethical implications of social media. Do
    9·1 answer
  • List and describe each of the activities of technology
    11·1 answer
  • Think about the five steps to writing an algorithm. Why is each step necessary?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!