Sunidhi Bansal has Published 1085 Articles

Product of all the Composite Numbers in an array in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 07:28:02

253 Views

Given an array arr[n] of n number of integers, the task is to find the product of all composite numbers in an array.Composite numbers are the whole numbers which are made by multiplying 2 other whole numbers. For example 6 is a composite number which can be made by multiplying ... Read More

Product of all pairwise consecutive elements in an Arrays in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 07:25:21

373 Views

Given an array arr[n] of n number of integers, the task is to find the product of all pairwise consecutive elements.Consecutive elements in an array arr[] are, if we are at ith element, i.e. arr[i] then its consecutive element will be either arr[i+1] or arr[i-1], so the product will be ... Read More

Probability that the pieces of a broken stick form a n sided polygon in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 07:23:38

167 Views

We are given with the stick of any length and that stick can be broken randomly into n pieces which can be of type integer or floating point and the task is to find whether the broken pieces can form a n sided polygon.We can calculate the probability by applying ... Read More

Probability of reaching a point with 2 or 3 steps at a time in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 07:22:16

312 Views

A person “A” is walking from a starting position X = 0, the task is to find the probability to reach exactly X = num, if he/she can either take 2 or 3 steps. Probability for step length 2 i.e. P, the probability for the step length 3 is 1 ... Read More

Probability of rain on N+1th day in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 07:20:33

195 Views

Given with an array containing 0’s and 1’s where 0’s represents no rain and 1’s represent rainy day. The task is to calculate the probability of rain on N+1th day.To calculate the probability of rain on N+1th day we can apply the formulaTotal number of rainy days in the set ... Read More

Probability of getting more value in third dice throw in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 07:18:10

122 Views

Given three players A, B, C throwing dice, we have to find the probability of the C throwing the dice and the number scored by C is higher than both A and B.To check the probability of getting more value, we have to keep in mind that the value of ... Read More

Program for weighted mean of natural numbers in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 07:16:26

1K+ Views

Given with an array of natural numbers and one more array containing the weights of the corresponding natural numbers and the task is to calculate the weighted mean of natural numbers.There is a formula which is used for calculating the weighted mean of natural numbers.$$\overline{x}=\frac{\displaystyle\sum\limits_{i=1}^n (x_{i*}w_{i})}{\displaystyle\sum\limits_{i=1}^n w_{i}}$$Where, x is the ... Read More

Program to check if water tank overflows when n solid balls are dipped in the water tank in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 07:13:55

241 Views

Given with the radius and height of cylindrical water tank, ‘n’ number of spherical solid balls with the radius and the volume of water in the tank and the task is to check whether the tank will overflow or not when balls are dipped in the tank.Formula to calculate the ... Read More

Program to check if an Array is Palindrome or not using STL in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 07:12:04

2K+ Views

Given an array arr[n] of n integers, the task is to find whether array is a palindrome or not. We have to do the stated task using STL in C++.In C++ there is a feature of STL(Standard Template Library), it is a set of C++ template classes which are used ... Read More

Program to check whether the given number is Buzz Number or not in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 13-Aug-2020 07:07:45

1K+ Views

Given with a number ‘n’ and the task is to determine whether the given positive integer is a buzz number or not and display the result as an output.What is Buzz Number?For being a buzz number there are two conditions either of which must be true −Number should end with ... Read More

Advertisements