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
What is the benefit of the load balancing logic to end-user?
Alborosie

Answer:

<em>It can minimize response time, and minimize the costs for the end user.</em>

Explanation

Load balancing is a form of workload distribution across several computers or resources. It allows each segment of the system to process a smaller task, minimizing respond time, helping to avoid overload, and contributing to optimize resource use.

6 0
2 years ago
Im lonnnelllly........................who want to date
blsea [12.9K]
Hey just a word of advice I hope you find someone lovely and someone who’ll enjoy you for you. Don’t look for people on apps like this I made many mistakes and it’s not smart. Have a good day. I get the feeling of loneliness and it sucks
8 0
2 years ago
What task can a user accomplish by customizing theme colors?
Stolb23 [73]

Answer:

D

Explanation:

I took the test

3 0
3 years ago
Read 2 more answers
How important are operating system in our devices?​
TiliK225 [7]

Answer:

Explanation:

An operating system is the most important software that runs on a computer. ... It also allows you to communicate with the computer without knowing how to speak the computer's language. Without an operating system, a computer is useless.

6 0
2 years ago
Read 2 more answers
Q1: what is significant about the contents of the destination address field?
Stells [14]
<span>The destination address field must contain the MAC address.
The MAC address is needed to help find a device for an ARP request.</span>
All hosts on the LAN will receive this broadcast frame. The host with the IP address of 192.168.1.1 (default gateway) will send a unicast reply to the source (PC host). This reply contains the MAC address of the NIC of the Default Gateway.
5 0
3 years ago
Read 2 more answers
Other questions:
  • In report design view, you can use commands on the align button of the _____ tab.​
    11·1 answer
  • Cuales son los accesorios electronicos mas recomendados?
    6·1 answer
  • Which occupation requires certification by the state?
    15·2 answers
  • How can you keep your files organized on your computer?
    13·2 answers
  • What is the impact of information technology in your daily life?
    12·1 answer
  • . public members are accessible from ________________ where the object is visible
    9·1 answer
  • __________ contain(s) remnants of word processing documents, e-mails, Internet browsing activity, database entries, and almost a
    9·1 answer
  • The advancement in speed of transportation is attributed to invention of this device
    8·1 answer
  • -) An attribute is a(n)?
    5·1 answer
  • Subscribe to my you tube channel to get all your questions answered
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!