Skip to main content

Posts

Showing posts from 2017

Decimal Number to Binary Number

A Binary Number consists of  0 s & 1 s only (Two Digits)   whereas a  Decimal Number Consists of 0,1,2,3,4,5,6,7,8,9 (ten digits) .                   For Example ( 111 )2 is binary number equivalent to decimal number ( 7 )10.  A bit is a single Binary Digit. The binary number above has three bits. Algorithm Divide the dividend(number) by divisor 2 and get the remainder & the quotient. If the quotient is not zero, then quotient becomes dividend and follow above step. As quotient has now become zero, the binary number is all the remainders from bottom or from right side which consists of 0 & 1. Flowchart To see the working of above Flowchart Click here to watch it on YouTube

Perfect Number

                    A Perfect number is a number that is equal to sum of its all positive divisors excluding the number itself.                         For  example 6 is a perfect number.      Sum of its divisor is equal to the number.                                   1+2+3=6                                               FLOWCHART          To see the working of Perfect Number Flowchart Click here to Watch on YouTube Learn to write a program in C to find whether a given number is perfect number or not. Click here to Watch on YouTube

Bubble Sort

               Bubble Sort is a sorting algorithm that works by comparing each pair of adjacent items and swapping them if they are in wrong order repeatedly till the list is sorted.               Bubble sort is also referred to as sinking sort or comparison sort . The algorithm is named for the way smaller or larger elements “bubble“ to the top of the list.              Bubble sort algorithm is the simplest algorithm for sorting but it is too slow and impractical for most problems. Bubble Sort Algorithm Step 1: Enter how many numbers(n) to sort. Step2: Enter all numbers and store it in array a[]. Step3: Make a key starting with second element of an array a[]. Step4: Now compare the [key-1] element of an array a[] with [key] element of an array a[]. Step5: For ascending order if the [key-1] element of an array a[] is greater than [key] element of an array a[] then swap the respective elements of an array a[]. Step6:Move the key to right to next element