Armstrong Number

A positive integer is called an Armstrong number of order n if: Source Code: Check Armstrong number Here, we ask the user for a number and check if it is an Armstrong number. We need to calculate the sum of the n-power of each digit. So, we initialize the sum to 0 and obtain each…

Continua a leggere →

Selection sort

SELECTION SORT is a comparison sorting algorithm that is used to sort a random list of items in ascending order. The comparison does not require a lot of extra space. It only requires one extra memory space for the temporal variable. By default, the sorted list is empty, and the unsorted list contains all the elements.…

Continua a leggere →

Pancake sorting…

Pancake sorting is the mathematical problem of sorting a disordered stack of pancakes in order of size when a spatula can be inserted at any point in the stack and used to flip all pancakes above it. A pancake number is the minimum number of flips required for a given number of pancakes. Unlike traditional…

Continua a leggere →