Arnab Chakraborty has Published 4293 Articles

Find N Geometric Means between A and B using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 06:04:44

225 Views

Suppose we have three integers A, B and N. We have to find N geometric means between A and B. If A = 2, B = 32, and N = 3, then the output will be 4, 8, 16The task is simple we have to insert N number of elements ... Read More

Find N Arithmetic Means between A and B using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 06:03:19

141 Views

Suppose we have three integers A, B and N. We have to find N arithmetic means between A and B. If A = 20, B = 32, and N = 5, then the output will be 22, 24, 26, 28, 30The task is simple we have to insert N number ... Read More

Find minimum sum of factors of number using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 06:01:24

401 Views

Here we will see how to get a minimum sum of factors of a given number. Suppose a number is 12. We can factorize this in different ways −12 = 12 * 1 (12 + 1 = 13)12 = 2 * 6 (2 + 6 = 8)12 = 3 * ... Read More

Find max in struct array using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 05:58:55

705 Views

Here we will see how to get max in the struct array. Suppose there is a struct like below is given. We have to find the max element of an array of that struct type.struct Height{    int feet, inch; };The idea is straight forward. We will traverse the array, ... Read More

Find last two digits of sum of N factorials using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 05:57:05

181 Views

Here we will see how to get the last two digits. The unit place digit and the tens place digit of the sum of N factorials. So if N = 4, it will be 1! + 2! + 3! + 4! = 33. so unit place is 3 and ten ... Read More

Find largest prime factor of a number using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 05:53:55

1K+ Views

Consider we have an element x, we have to find the largest prime factor of x. If the value of x is 6,  then-largest prime factor is 3. To solve this problem, we will just factorize the number by dividing it with the divisor of a number and keep track ... Read More

Find if two rectangles overlap using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 05:51:34

1K+ Views

We know that a rectangle can be represented using two coordinates, the top left corner, and the bottom right corner. Suppose there are two rectangles, we have to check whether these two overlap or not. There are four coordinate points (l1, r1) and (l2, r2).l1 is the top-left corner of ... Read More

Find if a number is part of AP whose first element and difference are given using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 05:47:45

519 Views

Suppose we have the first element of AP, and the differenced. We have to check whether the given number n is a part of AP or not. If the first term is a = 1, differenced = 3, and the term x = 7 will be checked. The answer is ... Read More

Find Harmonic mean using Arithmetic mean and Geometric mean using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Oct-2019 05:44:56

349 Views

Here we will see how to get the Harmonic mean using the arithmetic mean and the geometric mean. The formula for these three means are like below −Arithmetic Mean − (a + b)/2Geometric Mean − $$\sqrt{\lgroup a*b\rgroup}$$Harmonic Mean − 2ab/(a+b)The Harmonic Mean can be expressed using arithmetic mean and geometric ... Read More

Find floor and ceil in an unsorted array using C++.

Arnab Chakraborty

Arnab Chakraborty

Updated on 29-Oct-2019 12:03:00

674 Views

Here we will see how to find the floor and ceiling in an unsorted array. The floor value is larger element which is smaller than or equal to x, and the ceiling value is smallest value which is larger than x. If the array A = [5, 6, 8, 9, ... Read More

Advertisements