Program for N | CPP Program to find nth term of Arithmetic progression ; using formula to find the Nth term t ( n ) = a ( 1 ) + ( n - 1 ) * d ; Driver code ; starting number ; Common difference ; N th term to be find ; Display the output
#include <bits/stdc++.h> NEW_LINE 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 ; }