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]
4 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]4 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
Gabriel needs to create a formula that does not change when it is copied to cell b2. which formula should he create?
azamat
=sum(1+1)  it's a simple formula and won't change from any cells. Another you can do is to put a value in a specific cell, let's say, C3. Then have a formula that says, =sum(C3+2). But if you REALLY wanna impress someone - put a value in A1 - anything at all. Then put this formula in any other cell you want. If you change cells, you get a different answer. If you change the # in A1, you get different answers, all thanks to the RANDom function.  =SUM((RAND()*100)+A1)

4 0
4 years ago
I don’t understand this, i need help
Fittoniya [83]

Answer:

I don't understand this either sorry

Explanation:

5 0
3 years ago
Write the name of the tab, command group, and icon that is used to create multilevel lists.
qaws [65]

Answer:

Home Tab, Paragraph Group and Multilevel Icon.

Explanation:

The Tab on the Ribbon is Home, and the group is Paragraph. And there you will find the Multilevel Icon. Just select the one from it that suits you.

And for increasing the indentation to one more level Press Tab

For Outdenting, press, Shift+ tab

For adding an item at any indentation level, go to the last word, and press enter. And to opt-out of that indentation level, press enters two times.

Now transfer the insertion point to the last of the last most item in the number list, and then enter (press). and then press Del. or you can hit Enter and finally tap on the Numbering button, which you can find in the same tab( home) within the Paragraph group, and from there you can put off the number formatting.

3 0
3 years ago
Who is demonstrating entrepreneurship?
Taya2010 [7]

Answer: D: A recent graduate makes money helping teachers sell their lesson plans online.

Explanation: I am in accounting and have taken it for 3 years.

4 0
4 years ago
. In the select algorithm that finds the median we divide the input elements into groups of 5. Will the algorithm work in linear
8090 [49]

Answer:

we have that it grows more quickly than linear.

Explanation:

It will still work if they are divided into groups of 77, because we will still know that the median of medians is less than at least 44 elements from half of the \lceil n / 7 \rceil⌈n/7⌉ groups, so, it is greater than roughly 4n / 144n/14 of the elements.

Similarly, it is less than roughly 4n / 144n/14 of the elements. So, we are never calling it recursively on more than 10n / 1410n/14 elements. T(n) \le T(n / 7) + T(10n / 14) + O(n)T(n)≤T(n/7)+T(10n/14)+O(n). So, we can show by substitution this is linear.

We guess T(n) < cnT(n)<cn for n < kn<k. Then, for m \ge km≥k,

\begin{aligned} T(m) & \le T(m / 7) + T(10m / 14) + O(m) \\ & \le cm(1 / 7 + 10 / 14) + O(m), \end{aligned}

T(m)

​

 

≤T(m/7)+T(10m/14)+O(m)

≤cm(1/7+10/14)+O(m),

​

therefore, as long as we have that the constant hidden in the big-Oh notation is less than c / 7c/7, we have the desired result.

Suppose now that we use groups of size 33 instead. So, For similar reasons, we have that the recurrence we are able to get is T(n) = T(\lceil n / 3 \rceil) + T(4n / 6) + O(n) \ge T(n / 3) + T(2n / 3) + O(n)T(n)=T(⌈n/3⌉)+T(4n/6)+O(n)≥T(n/3)+T(2n/3)+O(n) So, we will show it is \ge cn \lg n≥cnlgn.

\begin{aligned} T(m) & \ge c(m / 3)\lg (m / 3) + c(2m / 3) \lg (2m / 3) + O(m) \\ & \ge cm\lg m + O(m), \end{aligned}

T(m)

​

 

≥c(m/3)lg(m/3)+c(2m/3)lg(2m/3)+O(m)

≥cmlgm+O(m),

​

therefore, we have that it grows more quickly than linear.

5 0
3 years ago
Other questions:
  • Select the correct answer.
    8·2 answers
  • Cloud computing is the fastest growing form of computing. <br> a. True <br> b. False
    9·1 answer
  • In our networked world, we have more opportunities to stereotype, which is problematic because:
    7·2 answers
  • 1)
    9·1 answer
  • rite a program that prompts the user to enter an integer and displays each of its numbers one by one.
    9·1 answer
  • a traditional wireless network involving access points that all have wired connections is known as a ?​
    5·1 answer
  • Which part of the operating system enables you to interact with the device? Question 9 options: The graphical user interface The
    8·1 answer
  • The current standard for RFID is based off of Group of answer choices MIT standards IEEE standards ISO standards there is no agr
    12·1 answer
  • Who first demonstrated the computer mouse?
    11·1 answer
  • This feature allows you to adjust your view to see the lower and upper part of a document
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!