Sudhir sharma has Published 1208 Articles

Armstrong Numbers between two integers?

sudhir sharma

sudhir sharma

Updated on 19-Aug-2019 12:57:02

825 Views

An integer is called an Armstrong number of order n if it's every digit separate out and cubed and summed up then the sum will be same as the number i.e. abcd... = a3 + b3 + c3 + d3 + ...In case of an Armstrong number of 3 digits, ... Read More

C++ Program for the BogoSort or Permutation Sort?

sudhir sharma

sudhir sharma

Updated on 19-Aug-2019 12:51:50

631 Views

Bogosort simply shuffles a collection randomly until it is sorted. BogoSort is an ineffective algorithm based permutation and combination that's why it is known Permutation sort. BogoSort is very flop sorting technique which is also known as, shotgun sort, stupid sort, monkey sort, or slow sort. The algorithm successively generates ... Read More

C++ Program for the Cocktail Sort?

sudhir sharma

sudhir sharma

Updated on 19-Aug-2019 12:47:46

210 Views

Cocktail sort is a variation of bubble sort that is both a stable sorting algorithm and a comparison sort also known as bidirectional bubble sort, cocktail shaker sort, shaker sort (which can also refer to a variant of selection sort), ripple sort, shuffle sort, or shuttle sort. The algorithm differs ... Read More

Add 1 to a number represented as a linked list?

sudhir sharma

sudhir sharma

Updated on 19-Aug-2019 12:34:52

478 Views

The linked list representation of a number is provided in such a way that the all nodes of the linked list are treated as one digit of the number. The node stores the number such that the first element of the linked list holds the most significant digit of the ... Read More

Add the elements of given arrays with given constraints?

sudhir sharma

sudhir sharma

Updated on 19-Aug-2019 12:24:27

184 Views

For this problem, to add elements of two given arrays we have some constraints based on which the added value will get changed. the sum of two given arrays a[] & b[] is stored into to third array c[]in such a way that they gave the some of the elements ... Read More

C program to calculate the value of nPr?

sudhir sharma

sudhir sharma

Updated on 19-Aug-2019 11:55:15

154 Views

Permutations, nPr can also be represented as P(n, r) is a mathematical formula to find the number of permutations. The formula of P(n, r) is n! / (n – r)!.The number of permutations on a set of n elements is given by n! where “!” represents factorial.Input:n=5;r=4; Output:120ExplanationP(5, 4) = ... Read More

C Program for Decimal to Binary Conversion?

sudhir sharma

sudhir sharma

Updated on 19-Aug-2019 11:53:39

919 Views

Convert an integer from decimal number system (base-10) to binary number system (base-2). Size of an integer is assumed to be 32 bits, need you to divide the number by the base. It is used by the computer to change integer values to bytes that are a computer.Input:10 Output:1010ExplanationIf ... Read More

C program to Find the Largest Number Among Three Numbers

sudhir sharma

sudhir sharma

Updated on 19-Aug-2019 11:50:53

478 Views

This program takes the 3 numbers and finds the biggest among all. For this, we will compare the numbers with each other and find out which is the largestInput: a=2, b=4, c=7 Output:7 Largest NumberExplanationThis program uses only if statement to find the largest number.Example#include using namespace std; int ... Read More

C program to Check Whether a Number is Positive or Negative or Zero?

sudhir sharma

sudhir sharma

Updated on 19-Aug-2019 11:49:19

781 Views

A number which is greater than 0 is positive and less than 0 are negative. The concept of positive and negative is very important in number theory and programming also. Calculations rely on this concept only.Input: 0 Output:0 is zeroExplanationUsing conditional statement check the number with 0 weather it is ... Read More

C Program to Check Armstrong Number?

sudhir sharma

sudhir sharma

Updated on 19-Aug-2019 11:47:26

291 Views

A number is called an Armstrong number if the sum of cubes of digits of the number is equal to the number itself. It is a mathematical concept usually used in programming to build basic logic of the programmerInput:370 Output:370 is an Armstrong NumberExplanation370 = 3*3*3 + 7*7*7 + 0*0*0 ... Read More

Advertisements