Find LCM of Two Fibonacci Numbers in C++

Ayush Gupta
Updated on 09-Oct-2020 07:34:02

201 Views

In this problem, we are given two numbers N and M. Our task is to create a program to find LCM of two Fibonacci Numbers in C++.Problem Description − We will find the Nth and Mth Fibonacci number. And then we will find the LCM of their two numbers and return the result.Fibonacci Numbers0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377....Let’s take an example to understand the problem,  Input: N = 4, B = 9Output:Explanation4th Fibonacci number is 29th Fibonacci number is 21LCM is 42.Solution ApproachTo solve the problem, we need to find ... Read More

Find Last Two Digits of Nth Fibonacci Number in C++

Ayush Gupta
Updated on 09-Oct-2020 07:22:00

612 Views

In this problem, we are given a number N. Our task is to create a Program to find last two digits of Nth Fibonacci number in C++.Problem DescriptionWe need to find the last two digits (i.e. the two LSB’s ) of the Nth Fibonacci number. Let’s take an example to understand the problem, Input: N = 120 Output: 81Solution ApproachA simple solution will be using the direct Fibonacci formula to find the Nth term. But this method will not be feasible when N is a large number. So to overcome this, we will use the property of the Fibonacci Series that ... Read More

Find Length of Bridge Using Speed and Length of Train in C++

Ayush Gupta
Updated on 09-Oct-2020 07:18:58

226 Views

In this problem, we are given the length (L) and speed (S) of the train along with the time taken by it to pass the bridge. Our task is to create a program to find Length of Bridge using Speed and Length of Train in C++.Problem DescriptionWe need to find the length of the bride using the speed of the train, the time taken by it to cross the bridge, And the length of the train.Let’s take an example to understand the problem, Input: L = 310, S = 45m/sec , time = 12 secOutput: 230 mSolution ApproachThe whole train ... Read More

Find N-th Term of Series 1, 2, 11, 12, 21 in C++

Ayush Gupta
Updated on 09-Oct-2020 07:14:38

144 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, 2, 11, 12, 21… in C++.Problem DescriptionTo find the Nth term of the series −1, 2, 11, 12, 21, 22, 111, 112, .... NtermsWe will find the general term of the series.Let’s take an example to understand the problem, InputN = 8Output112Solution ApproachTo derive the general term, we need to closely observe the series. In this series, we can see that there are only 1’s and 2’s in the value. And every term is an alternation of ... Read More

Find Line Passing Through 2 Points in C++

Ayush Gupta
Updated on 09-Oct-2020 07:09:53

880 Views

In this problem, we are given coordinates two points A and B on the coordinate plane. Our task is to create a program to find line passing through 2 Points in C++.Problem DescriptionTo find the line, we need to use the equation of the line and put the solution using the coordinates.Let’s take an example to understand the problem−Input: A = (3, 3) B = (6, 1) Output: 2x + 3y = 15Solution ApproachTo find the equation of the line, we will use the general equation of line −ax + by = cThis has to be satisfied by both the points ... Read More

Minimum Number of Lectures to Maintain 75% Attendance in C++

Ayush Gupta
Updated on 09-Oct-2020 07:08:24

1K+ Views

In this problem, we are given two numbers M and N that denote the total number of classes held till present data and the number of classes attended by the student respectively. Our task is to create a program to find minimum number of lectures to attend to maintain 75% in C++.Problem DescriptionThis is one of the biggest concerns of college students to maintain 75% percent attendance. This program calculates the minimum number of lectures that are to be attended regularly by the student to get an attendance of 75%.Let’s take an example to understand the problem, Example 1Input: M ... Read More

Find N-th Term of Series a, b, b, c, c, c in C++

Ayush Gupta
Updated on 09-Oct-2020 07:03:01

342 Views

In this problem, we are given a number N. Our task is to create a Program to find N-th term of series a, b, b, c, c, c…in C++.Problem DescriptionTo find the Nth term of the series −a, b, b, c, c, c, d, d, d, d, ....Nterms We need to find the general term of the series.Let’s take an example to understand the problem, InputN = 7OutputdSolution ApproachTo find the general term of the series, we need to closely observe the series. The series has 1 a, 2 b’s, 3 c’s, 4 d’s, ... This seems to be an AP. ... Read More

Find N-th Term in Given Series using C++

Ayush Gupta
Updated on 09-Oct-2020 06:57:04

270 Views

In this problem, we are given a number N. Our task is to create a program to find N-th term in the given series in C++.Problem DescriptionTo find the sum of the given series −1, 1, 2, 3, 4, 9, 8, 27, 16, 81, 32, 243, 64, 729, 128, 2187, 256, ... NTermsWe will find the general term of the series.Let’s take an example to understand the problem, Example 1InputN = 6Output9Example 2InputN = 13Output64Solution ApproachTo solve the problem, we need to carefully observe the series. As it is, a mixture series and these types of series are difficult to ... Read More

Find Nth Term Divisible by A or B in C++

Ayush Gupta
Updated on 09-Oct-2020 06:45:31

714 Views

In this problem, we are given three numbers A, B, and N. Our task is to create a program to find Nth term divisible by A or B in C++.Problem DescriptionThe Nth Term divisible by A or B. Here, we will find the term n number term which is divisible by number A or B. For this, we will count till nth numbers that are divisible by A or B.Let’s take an example to understand the problem, InputA = 4, B = 3, N = 5Output9ExplanationThe terms the are divisible by 3 and 4 are −3, 4, 6, 8, 9, ... Read More

Find N-th Term of Series 0, 0, 2, 1, 4, 2, 6, 3, 8 in C++

Ayush Gupta
Updated on 09-Oct-2020 06:38:22

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 0, 0, 2, 1, 4, 2, 6, 3, 8…in C++.Problem descriptionTo find the Nth term of the given series−0, 0, 2, 1, 4, 2, 6, 3, 8 .... N TermsWe will find the general term of the series.Let’s take an example to understand the problem, InputN = 8Output3Solution ApproachTo find the general term of the series, we need to closely observe the series. This series is a bit difficult to recognize as it is a mixture of two ... Read More

Advertisements