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
The Brinley website will not let me search for questions anymore. It says “Search all you want in-app” and then covers the quest
ira [324]

Answer: U can answer a few questions of other people’s questions then the question that was covered it unlocks after answering some questions and u will be able to see it or u could get the app too and it doesn’t block at all

Explanation:

4 0
3 years ago
Draw a flow chart that accepts mass and volume as input from the user. The flow chart should compute and display the density of
TiliK225 [7]

Answer:

See attachment for flowchart

Explanation:

The flowchart is represented by the following algorithm:

1. Start

2. Input Mass

3. Input Volume

4 Density = Mass/Volume

5. Print Density

6. Stop

The flowchart is explained by the algorithm above.

It starts by accepting input for Mass

Then it accepts input for Volume

Step 4 of the flowchart/algorithm calculated the Density using the following formula: Density = Mass/Volume

Step 5 prints the calculated Density

The flowchart stops execution afterwards

Note that the flowchart assumes that the user input is of number type (integer, float, double, etc.)

6 0
3 years ago
Write the simplest statement that prints the following on a single line: 3 2 1 Go! Note: Whitespace (blank spaces / blank lines)
Olin [163]

Answer:

//here is the statement in java.

import java.util.*;

//class definition

class Solution

{

// main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // this statement will print the 3 2 1 Go! and go to newline

       System.out.println("3 2 1 Go!");

   }catch(Exception ex){

       return;}

}

}

Explanation:

We can use "System.out.println()" to print the required output same as it required. After printing this, it will go to newline.

Output:

3 2 1 Go!

4 0
3 years ago
A(n) __________ is a set of technologies used for exchanging data between applications and for connecting processes with other s
Harrizon [31]

Answer:

The answer is "Option ".

Explanation:

The SOA stands for "Service-Oriented Architecture", which is primarily known as a service set and these services enable you to communicate with each other. In the communication, it may require simple data to transfer to two or more services, which can be organized by those operations, and other options were incorrect, that can be explained as follows:

  • In option a, It is a business software, which is used to organized data, that's why it is wrong.
  • Option b and Option d both are wrong because the mashup process is used only on web services, which is not a part of SOA , that's why it is wrong.
5 0
3 years ago
Read 2 more answers
Which of the following is NOT a popular computer programming
cestrela7 [59]
Answer is Xero. All the other Languages are Popular and Widely Used.
Thank You!
6 0
3 years ago
Other questions:
  • owen works in a real-estate office. A contract needs to be signed but the client is out of town. What should Owen do?
    14·1 answer
  • What are some programs that you have used that have condition-controlled loops and count-controlled loops?
    10·1 answer
  • Write a program that has the following String variables: firstName, middleName, and lastName. Initialize these with your first,
    7·1 answer
  • Your supervisor has asked you to set up a RAID hard drive array in a tower system, which has a motherboard that uses the B360 ch
    10·1 answer
  • ________ programming is a method of writing software that centers on the actions that take place in a program.
    8·1 answer
  • Two system administrators who work in two different buildings for the same company want to open a communication channel between
    8·1 answer
  • Devices which are used to receive data from central processing unit are classified as
    11·1 answer
  • Use the drop-down menus to complete the statements about message marking, categorizing, and flagging.
    13·2 answers
  • GOOD EVENING, FRIENDS, I WANT TO ASK ON THE ACCOUNT OF HIS NAME‏BENJEMIN360 . THIS ANSWERS ARE VERY WONDERFUL, BUT I CAN'T COMMU
    6·1 answer
  • The ____ file is typically saved with a prefix of inc_.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!