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
Which item is essential to know before sketching a navigation menu flowchart?
alisha [4.7K]

Answer:

A, template specifics, such as horizontal or vertical menu layout

Explanation:

4 0
2 years ago
Read 2 more answers
Aaron is stating the main idea of what he read in his own words. He is _____.
Feliz [49]

Answer:

summarizing

Explanation:

when someone explains in their own words the main idea of a story, it is summarizing.

8 0
2 years ago
Read 2 more answers
Simplify the Boolean expression (AB(C + BD) + AB]CD.
finlep [7]

Explanation:

Simplify the Boolean expression (AB(C + BD) + AB]CD.

6 0
2 years ago
Read 2 more answers
Ryder has discovered the power of creating and viewing multiple workbooks. ​ ​ Ryder wants to use a layout in which the workbook
777dan777 [17]

Answer:

Click the Cascade option button

Explanation:

Based on the description of what Ryder is attempting to accomplish, the next step that he needs to do would be to Click the Cascade option button. This option will cause all the windows of the currently running applications to overlap one another but at the same time show their title bars completely visible in order to let the user know their open status. Which is exactly what Ryder is attempting to make as his desired layout for the workbooks. Therefore this is the option he needs.

4 0
3 years ago
A company with a large number of hosts creates three subdomains under a main domain. For easier management of the host records,
REY [17]

Answer:

4

Explanation:

For easier management of the host records of the company 4 zones should be used because

subdomain is part of a larger domain and the main domain which is the primary domain is the name which the company have decide to use which will represent the company website address and in a situation where the company

have different domain names in which they had registered, they will need to choose one among the domain which will inturn be their main domain.

Therefore for easier , efficient and effective management of the host records 4 zones will be the best zones to be used.

Example of sub domain is north.example.com

4 0
3 years ago
Other questions:
  • Recall that book ciphers do not necessarily require a full book to decode, but instead any written text, such as the Declaration
    6·1 answer
  • What lie does E.D. tell to keep the musical from being canceled? There is a television crew coming to do a story on it. Jake wil
    6·1 answer
  • What is the most credible website or webpage you have ever visited?Why is it so credible? Describe some of the qualities that ma
    11·1 answer
  • What type of firewall works on the Session layer that creates a connection and allows packets to flow between the two hosts with
    8·1 answer
  • Suppose that a is declared as an int a[99]. Give the contents of the array after the following two statements are executed: for
    15·1 answer
  • URGENT!!! Which file format is used mainly in the Microsoft Windows operating system?
    15·2 answers
  • I will give brainliest!!!
    13·1 answer
  • How do you convert an algorithm to make it possible for a computer to read
    6·1 answer
  • How am i able to hear a presenter from a radio station through my fm tuner​
    14·1 answer
  • Busco a talcotalco38
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!