Thiru Malai

Selection sort:

The selection sort algorithm sorts an array by repeatedly finding the minimum element (considering ascending order) from unsorted part and putting it at the beginning. The algorithm maintains two subarrays in a given array. ) The subarray which is already sorted.

Set the first element as minimum and find the other numbers minimun than the first number.




A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward.

In the below program, user is asked to enter a positive number which is stored in the variable num.

The number is then saved into another variable n to check whether the original number has been reversed.

In the while loop, last digit of the number is seperated using the code digit=num%10.

Before adding the digit to rev, we first need to multiply the current data in the rev variable by 10 in order to add the digit to the last place in the number.

When the numbers are equal, the original number is a palindrome, otherwise it’s not.