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
lapo4ka [179]
3 years ago
11

Write a java program that declares an array "alpha" of 50 elements of type "double". Initialize the array so that the first 25 e

lements are equal to the square of the index variable and the last 25 elements are equal to three times the index variable. Output the array so that 10 elements per line are printed
Computers and Technology
1 answer:
Mars2501 [29]3 years ago
5 0

Answer:

Here is code in java.

import java.util.*;

class Number

{   //main method of the class

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

{

   try{

       // create an array of size 50 of double type

       double[] alpha = new double[50];

        //initialize array

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

               {

               if(x<25)

               {

                   alpha[x]= x * x;

               }

               else

               {

                   alpha[x]= 3 * x;

               }

            }

            //print 10 elements per line

            for(int y=1;y<=50;y++)

            {

                System.out.print(alpha[y-1] +" ");

                if(y%10==0)

                {

                    System.out.println();

                }

            }

   }catch(Exception ex){

       return;}

}

}

Explanation:

Create an array size 50 of double type.initialize first 25 elements as square

of the index variable and rest 25 as three times the index variable.Then print

the elements of array using for loop, if there is 10 elements in a line then

print a newline.

Output:

0.0 1.0 4.0 9.0 16.0 25.0 36.0 49.0 64.0 81.0

100.0 121.0 144.0 169.0 196.0 225.0 256.0 289.0 324.0 361.0

400.0 441.0 484.0 529.0 576.0 75.0 78.0 81.0 84.0 87.0

90.0 93.0 96.0 99.0 102.0 105.0 108.0 111.0 114.0 117.0

120.0 123.0 126.0 129.0 132.0 135.0 138.0 141.0 144.0 147.0

You might be interested in
Briefly list four of the basic I/O interface standard? ​
tiny-mole [99]

Four of the basic I/O interface standard are PCI, SCSI, USB and ISA.

<h3>Standard I/O Interface</h3>

Input-Output Interface is used as an method which helps in transferring of information between the internal storage devices. A number of standards have been developed for I/O Interface.

There widely used bus standards are:

  • PCI (Peripheral Component Interconnect)
  • SCSI (Small Computer System Interface), and
  • USB (Universal Serial Bus).
  • ISA (Industry Standard Architecture)

Find out more on Standard I/O Interface at: brainly.com/question/24347579

4 0
3 years ago
What are 3 websites that talk about density of different gases, density in air, behavior of different gases of earth, convection
Tanzania [10]
I don’t know if this supports all, but try lenntech, duckters, and I will add on later
6 0
3 years ago
What is not a benefit of exploring tabs and groups in Microsoft Word?
MrRa [10]
Microsoft's<span> direct participation </span>not<span> only assures you that MOAC textbook content is accurate and current</span>
8 0
4 years ago
Read 2 more answers
The person or persons requesting the worksheet should supply their requirements in a _____ document
ziro4ka [17]
<span>The person or persons requesting the worksheet should supply their requirements in a requirements document. </span>
3 0
4 years ago
Differentiate between soft copy output and hard copy output?​
katen-ka-za [31]

a hard copy stores data and information in the form of physical files it may be images text photographs and more a soft copy data and information in the form of virtual file saved on a computer or a drive you can preserve a hard copy for two long because its day subjected to wear and tear

4 0
2 years ago
Read 2 more answers
Other questions:
  • What is the easiest way to be sure you have selected all of the content related to a specific tag?
    11·1 answer
  • In the game of economics, which player has the role of providing goods and services
    10·1 answer
  • George, a user, has contacted you to complain that his issue has not been resolved. He has already contacted your department twi
    9·1 answer
  • To hide the ribbon, ______ on any one of the tabs of the ribbon.
    10·1 answer
  • You are configuring IP settings on a new network. For the external interfaces, you decide to obtain registered IP addresses from
    5·1 answer
  • The scheme function (mult2-diff Ist) should take one argument, a list of numbers, and results in multiplying each number in the
    11·1 answer
  • Flash drives, CDs, external disks are all examples of storage (memory) devices.'True or false?
    9·1 answer
  • Why do you think that network and telecommunications security careers are some of the fastest growing in the field of technology
    8·1 answer
  • How to print something nad input on same line python
    8·1 answer
  • How do you create a function in C++
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!