Sudhir sharma has Published 1149 Articles

Sum of two large numbers in C++

sudhir sharma

sudhir sharma

Updated on 17-Aug-2020 10:40:28

5K+ Views

In this problem, we are given two string that defines two large numbers. Our task is to create a program to find the sum of two large numbers.Let’s take an example to understand the problem, Input: number1 = “341299123919” number2 = “52413424” Output: 341351537343To solve this problem, we will traverse ... Read More

Sum of the series Kn + ( K(n-1) * (K-1)1 ) + ( K(n-2) * (K-1)2 ) + ... (K-1)n in C++

sudhir sharma

sudhir sharma

Updated on 17-Aug-2020 10:22:15

322 Views

In the problem, we are ginen two number k and n of the series K^n + ( K^(n-1) * (K-1)^1 ) + ( K^(n-2) * (K-1)^2 ) + ... (K-1)^n. Our task is to create a program to find the sum of the series.Let’s take an example to understand the ... Read More

Sum of XOR of all subarrays in C++

sudhir sharma

sudhir sharma

Updated on 17-Aug-2020 10:14:33

1K+ Views

In this problem, we are given an array arr[] of n numbers. Our task is to create a program to find the sum of XOR of all subarrays of the array.Here, we need to find all sub-arrays of the given array, and then for each subarray, we will find the ... Read More

Sum of XOR of all possible subsets in C++

sudhir sharma

sudhir sharma

Updated on 17-Aug-2020 10:00:52

416 Views

In this problem, we are given an array aar[] of n numbers. Our task is to create a program to find the Sum of XOR of all possible subsets.Here, we will find all subsets of the array. Then for each subset, we will find the XOR of elements of the ... Read More

Sum of XOR of all pairs in an array in C++

sudhir sharma

sudhir sharma

Updated on 17-Aug-2020 09:58:43

2K+ Views

In this problem, we are given an array arr[] of n integers. Our task is to create a program to find the sum of XOR of all pairs in an array.Let’s take an example to understand the problem, Input: arr[] = {5, 1, 4} Output: 10 Explanation: the sum of ... Read More

Sum of upper triangle and lower triangle in C++

sudhir sharma

sudhir sharma

Updated on 17-Aug-2020 09:49:49

1K+ Views

In this problem, we are given a matrix. Our task is to create a program to print the sum of upper triangle and lower triangle.Lower triangleM00                     0             0       …       ... Read More

Sum of two numbers modulo M in C++

sudhir sharma

sudhir sharma

Updated on 17-Aug-2020 09:40:20

624 Views

In this problem, we are given three numbers a, b, and M. our task is to create a program to find the sum of two numbers modulo M.Let’s take an example to understand the problem, Input: a = 14 , b = 54, m = 7 Output: 5 Explanation: 14 ... Read More

Sum of the series 2^0 + 2^1 + 2^2 +...+ 2^n in C++

sudhir sharma

sudhir sharma

Updated on 17-Aug-2020 09:17:02

1K+ Views

In this problem, we are given a number n which defines the n-th term of the series 2^0, 2^1, 2^2, …, 2^n. Our task is to create a program to find the sum of the series 2^0 + 2^1 + 2^2 +...+ 2^n.Let’s take an example to understand the problem, ... Read More

Sum of the series 2 + (2+4) + (2+4+6) + (2+4+6+8) + ... + (2+4+6+8+...+2n) in C++

sudhir sharma

sudhir sharma

Updated on 14-Aug-2020 14:16:51

291 Views

In this problem, we are given a number n which defines the nth term of the series 2 + (2+4) + (2+4+6) + (2+4+6+8) + ... + (2+4+6+8+...+2n). Our task is to create a program to find the sum of the series.Let’s take an example to understand the problem, Input n ... Read More

Sum of the Series 1/(1*2) + 1/(2*3) + 1/(3*4) + 1/(4*5) + ... in C++

sudhir sharma

sudhir sharma

Updated on 14-Aug-2020 14:04:06

653 Views

In this problem, we are given a number n which is the nth term of the series 1/(1*2) + 1/(2*3) +…+ 1/(n*(n+1)). Our task is to create a program to find the sum of the series.Let’s take an example to understand the problem, Input n = 3Output 0.75Explanation − sum = 1/(1*2) + ... Read More

Advertisements