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
Macro photographs are what type of photographs? A. Close-up B. Telephoto C. Abstract D. All of the above
scZoUnD [109]

Answer:

A

Explanation:

they are close up. they are not telephoto or abstract

marco can be telephoto, but it is not nessacarily always telephoto. marco is by definition a close up photo

5 0
3 years ago
When microsoft introduced its zune mp3 player, many people thought it would capture the mp3 player market by pricing its product
SSSSS [86.1K]
Your answer would be:  P<span>redatory Pricing .</span>
8 0
3 years ago
In the early 1800's, a “computer" was not a machine, it was a person who did math
balu736 [363]

Answer:

True

brainly needs more words apparently

7 0
3 years ago
Read 2 more answers
Trevor got home from work and suddenly realized that he needed to edit a certain file stored in the company network's server. ho
gregori [183]

I believe the answer is Virtual Private Network (VPN).

Know this answer is late, but im doing my deed hoping i this can help someone else pass this darn class. Best of Luck to whoever is taking the same course. You can do it if my lazy self can do it! It'll be okay ;)

3 0
3 years ago
All of the following are parts of the word processing window except _____. \
Rainbow [258]
<span>All of the following are parts of the word processing window except for the button esc ____.</span>
5 0
3 years ago
Other questions:
  • Windows explorer has a pane located on the left side which can display the directory structure of one or more drives. what is th
    15·1 answer
  • What does computer means?
    13·2 answers
  • Jason works as an accountant in a department store. He needs to keep a daily record of all the invoices issued by the store. Whi
    13·2 answers
  • A software engineer is designing a new program. She decides to first define all the classes needed, and how they will interact w
    5·2 answers
  • write a pay-raise program that requests a person's first name, last name, and current annual salary, and then displays the perso
    6·1 answer
  • COMO HA SIDO LA INNOVACION DE ESTE OBJETO TECNOLOGICO DURANTE SU EVOLUCIÓN
    8·1 answer
  • 5. An external CSS file is saved with D. Answer the following questions. 1. Explain the purpose and advantages of using CSS.​
    7·1 answer
  • Which of the following could be a method for an object-oriented class called Student?
    8·1 answer
  • Why are salaried employees often excluded from overtime pay
    5·1 answer
  • Which backup requires a small amount of space and is considered to have an involved restoration process?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!