Arnab Chakraborty has Published 4458 Articles

C/C++ Program for Median of two sorted arrays of same size?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

265 Views

Here we will see how to get the median of two sorted array of the same size. We will use C++ STL to store array elements. After getting two arrays, we will merge them into one. As two arrays of same size are merged, then the final array will always ... Read More

C Program for compound interest?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

751 Views

Here we will see how to get the compound interest by writing one C program. The logic is very easy. Here we need some parameters −P − Principle amountR − Rate of interestT − Time spanThe compound interest formula is like belowExample#include #include float compoundInterest(float P, float T, float R) ... Read More

C Program for cube sum of first n natural numbers?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

2K+ Views

In this problem we will see how we can get the sum of cubes of first n natural numbers. Here we are using one for loop, that runs from 1 to n. In each step we are calculating cube of the term and then add it to the sum. This ... Read More

C Program for Difference between sums of odd and even digits?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

444 Views

Suppose we have one long integer. We have to find if the differences between the sum of the odd position digits, and the sum of the even position digits are 0 or not. The positions are start from 0 (left most).For example, suppose a number is 156486. The odd position ... Read More

C Program for efficiently print all prime factors of a given number?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

451 Views

In this section, we will see how we can get all the prime factors of a number in an efficient way. There is a number say n = 1092, we have to get all prime factors of this. The prime factors of 1092 are 2, 2, 3, 7, 13. To ... Read More

C Program for Extended Euclidean algorithms?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

695 Views

Here we will see the extended Euclidean algorithm implemented using C. The extended Euclidean algorithm is also used to get the GCD. This finds integer coefficients of x and y like below −𝑎𝑥+𝑏𝑦 = gcd(𝑎, 𝑏)Here in this algorithm it updates the value of gcd(a, b) using the recursive call ... Read More

C Program for Find largest prime factor of a number?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

2K+ Views

In this section, we will see how we can get the largest prime factor of a number in an efficient way. There is a number say n = 1092, we have to get the largest prime factor of this. The prime factors of 1092 are 2, 2, 3, 7, 13. ... Read More

C Program for Find sum of odd factors of a number?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

899 Views

In this section, we will see how we can get the sum of all odd prime factors of a number in an efficient way. There is a number say n = 1092, we have to get all factor of this. The prime factors of 1092 are 2, 2, 3, 7, ... Read More

Advertisements