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
asambeis [7]
3 years ago
9

Write a function file that accepts the values of r, a and n as arguments and uses a for loop to return the sum of the first n te

rms of the geometric series. test your function for a = 3, r = 1/2 and n = 10.
Computers and Technology
1 answer:
Murrr4er [49]3 years ago
7 0

Given, a = 3, r = 1/2, n = 10

%r is common ratio

%n is number of terms

%a is the first term of the series

Sum = 0;

a = 3;

r = 1/2;

for i = 0 : 1 :  10;

Sum = Sum + a * r ^ i;

end

Sum


You might be interested in
What error occurs when you perform an illegal math operation such as divide by zero
ch4aika [34]

the answer is Arithmetic Exception error

7 0
3 years ago
The following 2D array has been created:
Airida [17]

Answer:

public class Main

{

public static void main(String[] args) {

 

 int [][] a = new int[4][5];

 

 a[0][0] = 1;

 a[0][1] = 2;

 a[0][2] = 3;

 a[0][3] = 4;

 a[0][4] = 5;

 a[1][0] = 10;

 a[1][1] = 9;

 a[1][2] = 8;

 a[1][3] = 7;

 a[1][4] = 6;

 a[2][0] = 11;

 a[2][1] = 12;

 a[2][2] = 13;

 a[2][3] = 14;

 a[2][4] = 15;

 a[3][0] = 20;

 a[3][1] = 19;

 a[3][2] = 18;

 a[3][3] = 17;

 a[3][4] = 16;

 

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

     for (int j = 0; j < 5; j++){

         System.out.print(a[i][j] + " ");

     }

     System.out.print("\n");

 }

}

}

Explanation:

  • Inside the main method, initialize the 2D array with their respective values at the appropriate indexes.
  • Iterate over the 2D array using a nested For loop.
  • The outer loop iterates over the rows, while the inner loop iterates over the columns of the 2D array respectively.
  • Finally inside the nested For loop, print the value of 2D array using the i and j index.

Output:

1 2 3 4 5

10 9 8 7 6

11 12 13 14 15

20 19 18 17 16

4 0
3 years ago
Read 2 more answers
Internet control message protocol (icmp) is a method of ip address assignment that uses an alternate, public ip address to hide
Elanso [62]
B False





---------------------------------
3 0
4 years ago
What is presentation
Gelneren [198K]
To present something infront of a crowd
5 0
3 years ago
Read 2 more answers
Describe the concepts of Defense in Depth and Detection in Depth. Compare and contrast. What's different? What's similar?
olchik [2.2K]

Answer:

 The main concept of the defense in depth is that the various defensive mechanism series are used for protecting the data and the information in the system. This approach is basically used multiple layers to control the cyber security. It also mainly provide the redundancy for controlling the security failure in the system.

The detection in depth basically provide the redundant overlapping approach and it is used for detecting the security and also accomplish the response that are available in the security detection.  

5 0
4 years ago
Other questions:
  • Select the most likely outcome of making only on-time minimum payments to a credit card with a balance for an entire year?
    7·2 answers
  • To build a user interface that contains graphical components, the components ____. must each be added to a separate panel. must
    7·1 answer
  • Write a pseudo-code that keeps asking the user for a given number 'n' different of zero, then print all numbers between one &amp
    8·1 answer
  • One software license model allows software to be freely distributed, downloaded, and installed without paying a license fee but
    15·1 answer
  • The database must be carefully planned to allow useful data manipulation and report generation.
    10·1 answer
  • Rick is linking different pages in his website. Match the value of the attribute to its meaning to enable Rick to choose the mos
    13·1 answer
  • Waygate's residential Internet modem works well but is sensitive to power-line fluctuations. On average, this product hangs up a
    6·1 answer
  • Consider the following declaration:
    9·1 answer
  • Read each of the following statements about Computer Science and explain why you think that statement is true.
    9·1 answer
  • ________ take advantage of vulnerabilities in software. Group of answer choices Blended threats Bots Trojan horses Direct-propag
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!