Sudhir sharma has Published 1206 Articles

Add N digits to A such that it is divisible by B after each addition?

sudhir sharma

sudhir sharma

Updated on 16-Aug-2019 10:51:17

86 Views

Given a, b and n. And we have to consider the following conditions and find the optimal solution to add n digits to a such that it is divisible by b after every iteration.Add a digit to a in such a way that after adding it, a is divisible by b.Print the smallest ... Read More

Area of a square inscribed in a circle which is inscribed in an equilateral triangle in C Program?

sudhir sharma

sudhir sharma

Updated on 13-Aug-2019 10:21:35

113 Views

The program to find the area of a square inscribed in a circle which itself is inscribed in an equilateral triangle. The radius of circle inscribed inside an equilateral is a/(2√3).The diameter of circle is the diagonal of square, d = 2 * r = a/ √3 Area formula for area ... Read More

Area of a n-sided regular polygon with given Radius in C Program?

sudhir sharma

sudhir sharma

Updated on 13-Aug-2019 08:27:29

291 Views

A polygon is a ‘n’ sided closed figure.N sided polygon means a polygon with n equal sides. The radius of a polygon is distance between center and vertex.In the figure we can see that the whole polygon can be divided into n equal polygonWe know, area of the triangle = ... Read More

Superperfect Number in C programming

sudhir sharma

sudhir sharma

Updated on 13-Aug-2019 07:50:54

328 Views

The concept of super perfect number is similar to the perfect number. It was found by D Suryanarayana in 1969. He generalized the super perfect number as a number that satisfies the following formula :sig(sig(n)) = 2nHere, sig(n) is the function that calculates the sum of divisors of a number, ... Read More

Super Prime in c programming

sudhir sharma

sudhir sharma

Updated on 13-Aug-2019 07:49:34

1K+ Views

A super-prime number is A number that occupies prime number position in the sequence of all prime numbers. also known as high order primes, These numbers occupy the position in the sequence of prime number which is equal to Prime number. some super prime numbers are 3, 5, 11, 1 ... Read More

C/C++ Program for nth Catalan Number?

sudhir sharma

sudhir sharma

Updated on 13-Aug-2019 06:45:25

450 Views

Catalan numbers are a sequence of numbers. Catalan numbers form a sequence of natural numbers that occur in various counting problems, often involving recursively-defined objects.Cn is the number of Dyck words of length 2n. A Dyck word is a string consisting of n X's and n Y's such that no ... Read More

Add minimum number to an array so that the sum becomes even in C programming

sudhir sharma

sudhir sharma

Updated on 09-Aug-2019 13:22:25

157 Views

Given an array, add the minimum number (which should be greater than 0) to the array so that the sum of array becomes even.Input - 1 2 3 4, Output - 2Explanation - Sum of array is 10, so we add minimum number 2 to make the sum even.Method 1: calculate the sum ... Read More

Arithmetic Mean in C programming

sudhir sharma

sudhir sharma

Updated on 09-Aug-2019 13:15:22

2K+ Views

Arithmetic mean is the sum of a collection of numbers divided by the number of numbers in the collection.Basic properties of Arithmetic MeanThe mean of n numbers x1, x2, . . ., xn is x. If each observation is increased by p, the mean of the new observations is (x ... Read More

C++ Program for Dijkstra’s shortest path algorithm?

sudhir sharma

sudhir sharma

Updated on 09-Aug-2019 13:08:53

14K+ Views

Dijkstra's algorithm (or Dijkstra's Shortest Path First algorithm, SPF algorithm) is an algorithm for finding the shortest paths between nodes in a graph, which may represent, for example, road networks. The algorithm creates a tree of shortest paths from the starting vertex, the source, to all other points in the ... Read More

C Program to Check if all digits of a number divide it

sudhir sharma

sudhir sharma

Updated on 09-Aug-2019 12:33:53

552 Views

For a number n given, we need to find whether all digits of n divide it or not i.e. if a number is ‘xy’ then both x and y should divide it.SampleInput - 24 Output - Yes Explanation  - 24 % 2 == 0, 24 % 4 == 0Using conditional statements checking if ... Read More

Advertisements