Answer to Question #306238 in C++ for Hardie

Question #306238

Using user defined function;write and run C++ program that computes the first 10 terms of an Arithmetic Progression (AP)

1
Expert's answer
2022-03-05T04:11:34-0500
#include <bits/stdc++.h>

using namespace std;

int Nth_of_AP(int a, int d, int N) {
    return (a + (N - 1) * d);
}

int main() {
    int a = 2;
    int d = 1;
    int N = 5;
    cout << "The " << N
         << "th term of the series is : "
         << Nth_of_AP(a, d, N);

    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog