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 type of rain happens when cold air meets warm air
Elodia [21]
A tornado happens when you mix cold with hot
5 0
3 years ago
Match the context details with the pattern that applies.
tia_tia [17]

Answer:

1. - Observer

2. - iterator

3. - strategy

4. - composite

5. - decorator

Explanation:

An object contains other objects (elements) and must give access to them for clients, without exposing its internal structure. This is an observation.

The subject-object can generate events as an iterable (iterator) and could use different strategic algorithms to achieve a task. Class objects can be used to aggregate other class objects.

In python, the decorator function mimics the outer function of a nested function, but still maintains the functionality of the second function

6 0
3 years ago
How do you change the top and bottom margins of an entire document?
Firdavs [7]

Answer:

Click the Page Layout tab and then the Margins button.

Choice D is correct

Explanation:

In order to change the top and bottom margins of an entire document, simply

Click the Page Layout tab and then the Margins button.

I hope this helps..

Great Day ahead

4 0
3 years ago
Read 2 more answers
If you want to adjust the width of a column manually, move your mouse over the _______ column boundary and click and drag until
Luda [366]

Answer:

The answer is "Right".

Explanation:

In computer science, editing is the primary activity, which is used by the users to handles graphics, tables, and other things. It can be divided into two types first is internal(default) and the second is manual.

  • In the manual editing, to edit the column of the table we just right click on the column.
  • It enables you to edit option, in which we edit column according to our desire.
6 0
3 years ago
5 things that i learned about internet safty
Ksenya-84 [330]
1. To not put your real name in a username
2. Don't give people your personal information
3. Tell your parents if someone messages you something and you don't know them
4. make your social media accounts private
5. Ask for a adult for help if you see something that confuses you
7 0
3 years ago
Read 2 more answers
Other questions:
  • Aubrey didnt like to use graphics or images on her slides. She preferred to use only a title for her slides and bullet-poinged t
    14·2 answers
  • If you know about 3D printers could you help me fix mine?
    8·1 answer
  • Explain the steps users can take to maintain an operating system
    15·1 answer
  • PLEASEEE HELPPPP me
    13·1 answer
  • What does “human-like” mean when we are talking about a machine?
    7·1 answer
  • Q1 To remove filter
    15·2 answers
  • Type the correct answer in the box. Spell all words correctly.
    11·1 answer
  • What is a for command? can u use a variable instead of a number in the for command!<br>​
    14·1 answer
  • After a group sets a project schedule, members should be prepared to
    7·1 answer
  • Energy/power management systems, kitchen appliances, smart televisions, baby monitors, fitness trackers, and personal health mon
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!