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
Nadusha1986 [10]
3 years ago
6

Implement the function:

Computers and Technology
1 answer:
Sloan [31]3 years ago
3 0

Answer:

This is written in C++

Check comments for explanations

Program starts here

#include<iostream>

#include<string>

using namespace std;

//The function get_ap_terms begins here

string get_ap_terms(int a, int d, int size_tn)

{  

// This line initializes the expected string to empty string

string result = "";

//The for iteration loops through the number of terms the function is expected to return

for(int i = 1; i<= size_tn;i++)

{

//This line checks if the loop is less than the number of  terms    

if(i < size_tn)

  {

//This string gets the current term of the progression

   result+=to_string(a)+ ", ";

//This line calculates the next term

   a+=d;  

  }

  else

  {

//This line calculates the last term

   result+=to_string(a);

  }

}

//This line returns the string containing the first n terms of the arithmetic progression

return result;

}

//The main function starts here

int main()

{

//This line declares the first term (a), the common difference (d) and the number of terms (size_tn)

int a,d,size_tn;

//This line prompts the user for the first term

cout<<"First Term: ";

//This line gets the first term

cin>>a;

//This line prompts the user for the common difference

cout<<"Common Difference: ";

//This line gets the common difference

cin>>d;

//This line prompts the user for number of terms

cout<<"Number of Terms: ";

//This line gets the number of terms

cin>>size_tn;

//This line calls the function to print the string containing the first n terms

cout<<get_ap_terms(a, d, size_tn);

return 0;

}

//Program ends here

You might be interested in
A company uses the account code 669 for maintenance expense. However, one of the company's clerks often codes maintenance expens
kotegsom [21]

Answer:

The correct answer to the following question will be "Valid-code test".

Explanation:

Even though no significance labels (including a standardized test score parameter) exist, valid data input codes or protocols could still be defined by having to type the correct codes as well as ranges.

  • To diagnose the given mistake, a valid code review will be the strongest internal control audit to incorporate into the organization's computer program.
  • To insert valid code the syntax is: <Code or Range>. Throughout this scenario, each code is decided to enter on another step.
3 0
3 years ago
Why do you think LinkedIn has become so popular?
mart [117]
Because it is a liable source for business.
6 0
3 years ago
1.What is a keyboard layout.
irina [24]

Answer:A keyboard layout is any specific physical, visual or functional arrangement of the keys, legends, or key-meaning associations  of a computer keyboard, mobile phone, or other computer-controlled typographic keyboard.

An output device is any peripheral that receives data from a computer, usually for display, projection

A printer is an output device that prints paper documents. This includes text documents, images, or a combination of both

Laser Printers and LED printers

Explanation:

8 0
2 years ago
Who was the father of computer​
masya89 [10]

Answer:

elon musk

Explanation:

8 0
3 years ago
In codd's model of a relational database, data is stored in a(n) _____, which maintains information about a(
Dmitry [639]
<span>Which is not a component of a database that describes how data is stored?</span>
5 0
3 years ago
Other questions:
  • When creating an input control (for example, a button) on a form the _____________ indicates the data that is contained in the n
    13·1 answer
  • "Because Standard Error and Standard Ouput represent the results of a command and Standard Input represents the input required f
    6·1 answer
  • Which of the following are typically an example of primary resources?
    13·1 answer
  • Wich technology can a website use to allow you to listen to a concert live over the internet?
    10·1 answer
  • Andre is teaching a class without the software development cycle while teaching the analyst phase which task should Andre mentio
    8·1 answer
  • Your boss is very skeptical about the idea of storing his files up in the cloud rather than on a local storage drive. He asks yo
    7·1 answer
  • Customizing ads to people who had earlier visited the site is
    14·1 answer
  • Given a constant named size with a value of 5, which statement can you use to define and initialize an array of doubles named ga
    12·1 answer
  • Expectation on Information Technology Fundamental​
    12·1 answer
  • Which of these is not the correct method for moving text in a document in Word 2016?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!