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
sasho [114]
3 years ago
5

Write a program that creates an integer array with 40 elements in it. Use a for loop to assign values to each element of the arr

ay so that each element has a value that is triple its index. For example, the element with index 0 should have a value of 0, the element with index 1 should have a value of 3, the element with index 2 should have a value of 6, and so on.
Computers and Technology
1 answer:
iogann1982 [59]3 years ago
8 0

Answer:

public class Main

{

public static void main(String[] args) {

 int[] numbers = new int[40];

 for (int i=0; i<40; i++){

     numbers[i] = i * 3;

 }

 for (int i=0; i<40; i++){

     System.out.println(numbers[i]);

 }

}

}

Explanation:

*The code is in Java.

Initialize an integer array with size 40

Create a for loop that iterates 40 times. Inside the loop, set the number at index i as i*3

i = 0, numbers[0] = 0 * 3 = 0

i = 1, numbers[1] = 1 * 3 = 3

i = 2, numbers[2] = 2 * 3 = 6

.

.

i = 39, numbers[39] = 39 * 3 = 117

Create another for loop that iterates 40 times and prints the values in the numbers array

You might be interested in
In three to five sentences, explain the function of the computer's operating system.
Sati [7]

Answer:

An Operating System (OS) is an interface between a computer user and computer hardware. An operating system is a software which performs all the basic tasks like file management, memory management, process management, handling input and output, and controlling peripheral devices such as disk drives and printers.

Explanation:

3 0
3 years ago
During the _______ steps of the information processing cycle, data is manipulated, calculated, or organized to create useful inf
labwork [276]

Answer: processing

Explanation:

During the processing steps of the information processing cycle, data is manipulated, calculated, or organized to create useful information.

At this stage, the data that has been gotten will have to be worked on by manipulating it, making necessary calculations in order to get a useful information out of it.

6 0
3 years ago
What is Activation code for wwe 2k20 ​
Arte-miy333 [17]
Shouldn’t you get that in your email when you sign up.
5 0
3 years ago
Read 2 more answers
Complete the missing part of the line to allow you to read the contents of the file.
Firlakuza [10]

Answer: Sorry I’m late but the answer is open

Explanation: Edge 2021

3 0
3 years ago
Read 2 more answers
What type of open source programming language is python
Vlada [557]

Answer:

Python is developed under an OSI-approved open source license, making it freely usable and distributable, even for commercial use. Python's license is administered by the Python Software Foundation.

Explanation:

g00gle

3 0
2 years ago
Other questions:
  • The collodion process was significantly more expensive than the cost of a daguerreotype
    10·1 answer
  • Which two computer peripherals are connected to the computer through a port?
    9·1 answer
  • In general, what is the leftmost point of a circle with radius r centered at (x,y)?
    8·1 answer
  • Renee is creating a multimedia presentation for a website that requires user interaction. Which multimedia type is Renee using?
    5·2 answers
  • The main advantage of a solid state drive is:
    5·1 answer
  • Why is it important to brain storm and develop concepts prior to selecting an idea that you wish to move forward with as a solut
    7·1 answer
  • A USB is used for _________.[ pick the best answer that makes sense]
    14·2 answers
  • How can rows be added to a table? Check all that apply.
    15·2 answers
  • Write a program that inputs a time from the console. The time should be in the format "HH:MM AM" or "HH:MM PM". Hours may be one
    6·1 answer
  • Which of the following is not a type of bank? (Everfi)
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!