Programming Articles - Page 1953 of 3366

Program to find N-th term of series 9, 23, 45, 75, 113… in C++

Ayush Gupta
Updated on 01-Oct-2020 11:33:07

266 Views

In this problem, we are given an integer n that denotes the nth term of the series. Our task is to create a program to find N-th term of series 9, 23, 45, 75, 113… in C++.Problem Description − Here, we need to find the nth term of the series for which we will be finding the general term of the series.The series is 9, 23, 45, 75, 113, 159, 213, …Let’s take an example to understand the problem, Input − n = 5output − 159Solution Approach, The general term of the given series isNth term = ( ((2*N + ... Read More

Program to find N-th term of series 7, 21, 49, 91, 147, 217, …… in C++

Ayush Gupta
Updated on 01-Oct-2020 11:35:06

119 Views

In this problem, we are given a number n that denotes the nth term of the series. Our task is to create a program to find the N-th term of series 7, 21, 49, 91, 147, 217, …… in C++.Problem Description - We will find the nth term of the series 7, 21, 49, 91, 147, 217, … and for that, we will deduce the general term of the series.Let’s take an example to understand the problem, Input − N = 5Output − 147Solution Approach:Let’s deduce the general term of the given series. The series is −7, 21, 49, 91, ... Read More

Program to find N-th term of series 4, 14, 28, 46, 68, 94, 124, 158, …..in C++

Ayush Gupta
Updated on 01-Oct-2020 12:17:29

610 Views

In this problem, we are given a number N. Our task is to create a program to find N-th term of series 4, 14, 28, 46, 68, 94, 124, 158, …..in C++.Problem Description − To find the Nth term of series4, 14, 28, 46, 68, 94, 124, … (N-terms),  We will find the general term of the series and calculate the value based on the value of n.Let’s take an example to understand the problem, Input − N = 5Output − 68Solution Approach:Let’s deduce the general term of the given series. The series is:4, 14, 28, 46, 68, 94, 124….We ... Read More

Program to find N-th term of series 3, 12, 29, 54, 87, … in C++

Ayush Gupta
Updated on 01-Oct-2020 12:19:11

180 Views

In this problem, we are given a number N. Our task is to create a program to find N-th term of series 3, 12, 29, 54, 87, … in C++.The series is3, 12, 29, 54, 87, 128, .... N-TermsLet’s take an example to understand the problem, Input − N = 5Output − 87Solution Approach:Let’s deduce the general term of the given series. The series is −3, 12, 29, 54, 87, 128, ....The general term of this series isTn = 4(n2 ) - 3*n + 2Using the general term formula, we can find any value of the series.For example, T8 = ... Read More

Program to find N-th term of series 3, 12, 29, 54, 86, 128, 177, 234, ….. in C++

Ayush Gupta
Updated on 15-May-2020 13:18:32

115 Views

In this tutorial, we will be discussing a program to find N-th term of series 3, 12, 29, 54, 86, 128, 177, 234, …..For this we will be provided with a number. Our task is to find the term for the given series at that particular position.Example Live Demo#include #include using namespace std; //calculating nth term of given series int nthTerm(int n) {    return 4 * pow(n, 2) - 3 * n + 2; } int main() {    int N = 4;    cout

Program to find N-th term of series 3, 6, 18, 24, … in C++

Ayush Gupta
Updated on 01-Oct-2020 12:21:23

414 Views

In this problem, we are given a number N. Our task is to create a Program to find N-th term of series 3, 6, 18, 24, … in C++.Problem Description − To find the Nth term of the series −3, 6, 18, 24, 45, 54, 84 … N TermsWe need to find the general formula for the given series.Let’s take an example to understand the problem, Input − N = 10Output − 150Solution Approach:To find the general term of the series, we will first observe the series and check all the possible generalizations of the series. Like, 3 is common ... Read More

Program to find N-th term of series 3 , 5 , 21 , 51 , 95 , … in C++

Ayush Gupta
Updated on 01-Oct-2020 12:23:16

127 Views

In this problem, we are given a number N. Our task is to create a Program to find N-th term of series 3 , 5 , 21 , 51 , 95 , … in C++.Problem Description − To find the Nth terms of the series −3, 5, 21, 51, 95, 153, … N-TermsWe need to find the general formula of the series, which is a quadratic equation (based increase in the series).Let’s take an example to understand the problem, Input − N = 6Output − 153Solution Approach:To solve the problem, we will find the general formula for the nth term ... Read More

Program to find N-th term of series 2, 4, 3, 4, 15… in C++

Ayush Gupta
Updated on 03-Oct-2020 09:38:27

213 Views

In this problem, we are given a number N. Our task is to create a program to find N-th term of series 2, 4, 3, 4, 15… in C++.Problem Description − To find the sum of the given series, 2, 4, 3, 4, 15, 0, 14, 16 .... N termsWe will find the formula for the general term of the series.Let’s take an example to understand the problem, Input − N = 9Output − 9Solution Approach:The increase of the values in the series is linear i.e. no square values are in the series. Also, it’s value depends on other factors ... Read More

Program to find N-th term of series 1 4 15 24 45 60 92... in C++

Ayush Gupta
Updated on 03-Oct-2020 09:39:18

132 Views

In this problem, we are given a number N. Our task is to create a program to find N-th term of series 1 4 15 24 45 60 92... in C++.Problem description − To find the nth term of the series −1, 4, 15, 24, 45, 60, 92, 112 … N termsWe will find the general formula for the series.Let’s take an example to understand the problem, Input − N = 6Output − 60Solution Approach, The general term of the series is based on whether the value of N is even or odd. This type of series is a bit ... Read More

Count number of bits changed after adding 1 to given N in C++

Sunidhi Bansal
Updated on 15-May-2020 12:52:46

213 Views

We are given a number let’s say num and the task is to calculate the total number of bits changed when 1 is added to a number.Binary representation of a number is done by converting the given number into the form of 0’s and 1’s and it is done by various methods. In one method, we calculate the LCM of a given number by 2 and if a reminder is other than 0 then the bit is set to 1 else it will be set to 0.Addition table for bits are0 + 1 = 1 1 + 0 = 1 ... Read More

Advertisements