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 another term for technology?
AysviL [449]
telecommunications is just one other term. there's also industrial science or automation
4 0
3 years ago
What is printed when the following code has been executed?
serg [7]
Hey it is 15 hope this helps
3 0
3 years ago
The java class library interface queue method tagg retrieves the entey at the front of a queue but themrows a NosuchElementExcep
SCORPION-xisa [38]

Answer:D) peek

Explanation:Peek operation or function is the method that is used for the returning of the values on the front of the queue or stack type datatypes.               This operation function over those datatypes having group or collection of the elements and does not eliminate any element from the queue.

NOsuchElemnet exception is shown when there is the peek operation in the queue for the element to be displayed on the top and no deletion can take place .Thus, the correct option is option(D).

5 0
3 years ago
What command is used to add a reflection or an outline to text
WARRIOR [948]

text effects, and typography.

6 0
3 years ago
Which type of link is normally used to interconnect two peripheral modules (pm) in the digital multiplex system (dms)?
natta225 [31]

The answer is DS-30A. The Roland DS30A is a 24-bit Digital Reference Monitor which can add pristine 24-bit/96kHz. They are small speakers.

4 0
3 years ago
Other questions:
  • Prove that for every nfa with an arbitrary number of final states there is an equivalent nfa with only one final state. Can we m
    8·1 answer
  • To reduce inflation, the Federal Reserve _____ the money supply. This action also causes the economy to shrink.
    13·2 answers
  • Where can you find gradpoint answers
    13·2 answers
  • Suppose that you want to write a program that inputs customer data and displays a summary of the number of customers who owe mor
    14·1 answer
  • How long does it take to be placed in a class on flvs?
    14·1 answer
  • What is an "immediate preemptive scheduler"?
    15·1 answer
  • Write a recursive method called sumTo that accepts an integer parameter n and returns a real number representing the sum of the
    12·1 answer
  • There are some games that cannot be described by a single--or even two-- genres. Can you think of any that should be invented?​
    6·1 answer
  • Will economists be replaced by artificial intelligence?
    12·1 answer
  • DRAW A FLOWCHART THAT WILL ASK THE USER TO ENTER AND DISPLAY THEIR PERSONAL DETAILS SUCH AS NAME AND AGE.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!