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
Setler [38]
3 years ago
5

Write a C program that declares an array alpha of 50 components of type double. Initialize the array so that the first 25 compon

ents are equal to the square of the index variable, and the last 25 components are equal to three times the index variable. Output the array so that 10 elements per line are printed.
Computers and Technology
1 answer:
OLEGan [10]3 years ago
7 0

Answer:

The c program for the following scenario is given below.

#include<stdio.h>

int main() {    

   double alpha [50];    

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

   {

       alpha[k] = ( k * k );

   }    

   for( int k = 25; k < 50; k++ )

   {

       alpha[k] = ( 3 * k );

   }    

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

   {

       if( k == 10 || k == 20 || k == 30 || k == 40 )

           printf("\n");            

       printf( "%lf", alpha[k]);

       printf(" ");

   }    

   return 0;    

}

 

OUTPUT

0.000000 1.000000 4.000000 9.000000 16.000000 25.000000 36.000000 49.000000 64.000000 81.000000  

100.000000 121.000000 144.000000 169.000000 196.000000 225.000000 256.000000 289.000000 324.000000 361.000000  

400.000000 441.000000 484.000000 529.000000 576.000000 75.000000 78.000000 81.000000 84.000000 87.000000  

90.000000 93.000000 96.000000 99.000000 102.000000 105.000000 108.000000 111.000000 114.000000 117.000000  

120.000000 123.000000 126.000000 129.000000 132.000000 135.000000 138.000000 141.000000 144.000000 147.000000

Explanation:

The program only uses one array of data type double and one variable of data type integer. The variable k is used in for loop.

The elements in the alpha array are initialized inside for loop.  

First loop initializes the first 25 elements to the square of its index variable, k.

Second loop initializes next 25 elements to thrice the value of the index variable, k.

The third loop displays the elements of the array.

Since the variable k is an integer, the values of the elements of the array are integers. But, the array is declared as double data type hence, the values are displayed in the format of double numbers.

Only 10 elements are displayed per line.

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

   {

// new line is inserted after 10 elements are displayed

       if( k == 10 || k == 20 || k == 30 || k == 40 )

           printf("\n");            

       printf( "%lf", alpha[k]);

       printf(" ");

   }

You might be interested in
Anybody wants to join my pad let to talk about video games
Rus_ich [418]

Answer:

im in

Explanation:

8 0
3 years ago
Read 2 more answers
What is the function of ROM?
Gnoma [55]

Answer:

Hello, There!

<h2>Your Question↓</h2>

What is the function of ROM?

<h2>Answer↓</h2>

Allows parts of the computer to communicate is the Correct Answer.

Explanation:

<h2>Now you May Ask What does it do or How it works↓</h2>
  • ⇒ROM provides the necessary instructions for communication between various hardware components.
  • ⇒ it is essential for the storage and operation of the BIOS, but it can also be used for basic data management, to hold software for basic processes of utilities.

Tip: Wanna know how to earn points back for asking your Question?

If you do it's easy just when two people answer your question whichever answer you think is the best click the crown on the side to get 25% of your points back! :D

Therefore, I hope this helps!

6 0
2 years ago
Rules used in naming variables in object oriented programming​
schepotkina [342]

Answer:

Explanation: Name your variables based on the terms of the subject area, so that the variable name clearly describes its purpose.

4 0
3 years ago
A user reports that a PC gets a BSOD on startup. A technician has researched the error message and found a driver to replace. Wh
7nadin3 [17]

Answer:

The explanation of this question is given below in the explanation section. however, the correct option of this question is "Boot the machine into safe mode"

Explanation:

BSOD error on startup

Blue screen of death error arises mostly when dirver produce fault into system or did not install properly. however, the correct option for this question, if PC gets BSOD error on startup then it is the best option for technician to remove the hardware that is recently installed and/or try to boot the machine into safe mode, then uninstall the driver that causing error on startup.

BSOD error occur during running the program on PC

However, if PC get BSOD during running program, then the best option for technician is to restart the machine and then install the driver properly. During this operation, as error occured, you may loss the data becuase you have no other option to save the data of program that is running.

6 0
3 years ago
Hidden-surface removal is the process of:
castortr0y [4]

Answer:

Option A.

Explanation:

In 3D computer graphics, this process determines which elements should not be visible from the desired point of view, and will prevent them from rendering. Thus, objects that lie behind opaque surfaces such as walls or panels, will not be rendered.

A good rendering algorithm helps to optimize the graphic engine because it will load as few elements as possible. Therefore, in larger worlds, the engine will remain at a stable speed and will be more efficient.

3 0
3 years ago
Other questions:
  • So for my Game Design class I have a quiz coming up...I was wondering if someone could answer some of these practice questions,
    7·2 answers
  • After unit and integration testing are completed, _________ testing ensures that all hardware and software components work toget
    7·1 answer
  • Assign testResult with 1 if either geneticMarkerA is 1 or geneticMarkerB is 1. If geneticMarkerA and geneticMarkerB are both 1,
    11·1 answer
  • When performing actions between your computer and one that is infected with a virus, which of the following offers NO risk of yo
    11·2 answers
  • The construction of a mixed media assemblage would be considered
    9·1 answer
  • question i need a real answer cuase i have a virus cuase off my borther and these are the notifacations i get and now these site
    11·1 answer
  • What would be an ideal scenario for using edge computing solutions?
    10·1 answer
  • In regard to segmentation, all of the following are examples of a customer's behavior or relationship with a product EXCEPT: a)
    14·1 answer
  • Please help ASAP! will mark brianliest! 30 points!
    14·1 answer
  • How is the architecture converted into software code? Elaborate the steps its passes through with help of examples / Diagram.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!