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
Keyboards that are widely used on various smartphones and other small portable devices, and which are designed primarily for com
mr Goodwill [35]

Answer:

Option A is the correct answer for the above question.

Explanation:

The keyboard is a device, by which a human can instruct the computer in the text form. There are so many keyboards in which, thumb keyboard is one of them. The thumb keyboard is found in mobile phones, smartphones or PDA phones, which is used for personal use. It is a designed layout of the keyboard that can be placed on the hand of the human and a person can type on its with the help of his thumb.

The above question asked about the type of the keyboard which is used in various smartphones and other phones. That keyboard is thumb keyboard which is described above and it is stated from the option A. So option A is the correct answer while the other is not because--

  • Option B states about the traditional keyboard which is used for the PC only.
  • Option C states about the Notebook keyboard which is used for the Notebook computers only.
  • Option D states about combination which is not a type of keyboard.
7 0
3 years ago
Write a function named shareALetter that takes one parameter, wordList – a list of words. Create and return a dictionary in whic
Arte-miy333 [17]
Can u send anything to understand it
7 0
2 years ago
The amount of time taken by each of 10 students in a class to complete an exam is an example of what type of data? a. Cannot be
vekshin1

Answer:d) Quantitative data

Explanation: Quantitative data is the data that is required for the measurement of count and then exhibited in the numeric values.It is expressed through the type of name, number,code, symbol etc. It is used in the questionnaire, surveys, interviews etc.

Other options are incorrect because time series data is data according to the time event and categorical data is based on the categories of event.Thus, the correct option is option(d).

8 0
2 years ago
Select all that apply. To select more than one worksheet at the same time, which of the following keys on your keyboard can you
Colt1911 [192]
<em>Shift </em>selects multiple worksheets at the same time. <em>Ctrl</em> selects all that you selected with Ctrl pressed.
4 0
3 years ago
The domain in an email message tells you the
Alexus [3.1K]
The type of service provider
8 0
3 years ago
Other questions:
  • Richman Investments is an investment and consulting firm. Richman wants to expand its business operations both in the U.S. and i
    14·1 answer
  • Which category of app does word processing software fall into? A. Productivity B. Entertainment C. Social networking D. Educatio
    14·2 answers
  • You would set a ___________ to prevent users from immediately changing their password several times in one day to return to the
    15·2 answers
  • What is anatomy of software house?
    10·1 answer
  • Consider the following definition of the recursive function mystery. int mystery(int first, int last) { if (first &gt; last) ret
    12·1 answer
  • Draw a dfd that shows how data will be stored, processed, and transformed in the tims system
    9·1 answer
  • Importance of computer​
    15·1 answer
  • What is polymerization1​
    11·1 answer
  • Phishing (pronounced fishing) is malware sent through e-mail that looks like a legitimate message from a trusted sender. The goa
    10·2 answers
  • Please help I need help with web technology I forgot to post the question in the last one. here it is tho.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!