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
Organizations should communicate with system users throughout the development of the security program, letting them know that ch
Fed [463]

Answer:

Yes it is true.The organization should indeed communicate with a system user throughout the development of a security program. A corporation needs a security policy that must be developed by management at all levels, including organization and employees at the operational level. For a corporate security plan, it is essential to reduce the resistance of the expected changes and define the objective.

Explanation:

Three objectives of the security plan in an organization are:

  • Identify the sensitive system and plan
  • Create and define the strategy and control of the system.
  • Develop and implement the training programs.

Security Information is one of the essential factors in the organization.For an organization, the information should be protected.

7 0
2 years ago
Write a function number_of_pennies() that returns the total number of pennies given a number of dollars and (optionally) a numbe
katovenus [111]

Answer:

The function is as follows:

def number_of_pennies(dollars,pennies=0):

   return dollars*100+pennies

   

Explanation:

This defines the function

def number_of_pennies(dollars,pennies=0):

This returns the number of pennies

   return dollars*100+pennies

<em>Note that, if the number of pennies is not passed to the function, the function takes it as 0</em>

5 0
2 years ago
Read 2 more answers
3. Which major NIMS Component describes systems and methods that help to ensure that incident personnel and other decision maker
mario62 [17]

Answer:

The answer to the following question is Communications & Information management .

Explanation:

National Incident Management System (in short NIMS), is the comprehensive and national approach to how state, tribal, territorial, federal and local responders reacts and responds during the emergency.

The components of NIMS are:

  • Command and Management,
  • Resource Management,
  • Preparedness,
  • Communication & Information,
  • Ongoing Management and Maintenance and
  • Supporting Technologies.
8 0
3 years ago
How to type the plus sign +
zmey [24]

Answer:

you just did it. its on da keyboard

Explanation:

hold shift and click the equal sign

Shift + = = +

7 0
2 years ago
Read 2 more answers
Which option can be used to access more settings than are available in the Backstage view?
Sedaia [141]

Answer:

Orientation settings

Explanation:

Orientation setting or general settings, we can find more options in Excel, we can make general and even advance setting with these options in the backstage view, the language and tabs can be changed in this section, the options are:

  • General
  • Formulas
  • Proofing
  • Save
  • Language
  • Advanced
  • Customize Ribbon
  • Quick access toolbar
  • Add-ins
  • Trust Center
6 0
3 years ago
Read 2 more answers
Other questions:
  • Which visual aid should Emil use to compare and contrast the political systems in three countries?
    13·1 answer
  • If metal shims are used for alignment adjustment in the front, they adjust ________.
    5·1 answer
  • Consider the following threats to Web security, and describe how each is countered by a particular feature of SSL.
    15·1 answer
  • What makes the huns a formidable force for the roman empire?
    5·1 answer
  • + Use for loop to print numbers from 100 to 10
    11·1 answer
  • Renee works for a television series. Her responsibility is to transfer data from the camera to a hard drive. What is her job des
    5·1 answer
  • Today you will be researching three forms of technology.
    6·1 answer
  • Select the correct answer from each drop-down menu. Computer memory stores data as a series of 0s and 1s. In computer memory, re
    14·1 answer
  • HELP URGENT
    5·1 answer
  • Can someone please tell me what I’m doing wrong ? Please and it’s due on Thursday!!
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!