Find n | CPP program to find the nth term of the series 1 2 2 3 3 3 ... ; function to solve the quadratic equation ; calculating the Nth term ; driver code to check the above function
#include <bits/stdc++.h> NEW_LINE using namespace std ; int term ( int n ) { int x = ( ( ( 1 ) + ( double ) sqrt ( 1 + ( 8 * n ) ) ) / 2 ) ; return x ; } int main ( ) { int n = 5 ; cout << term ( n ) ; return 0 ; }