C program to convert Octal to Decimal number system
Example Input Input octal number: 172 Output Decimal number: 122 Logic to convert from octal to decimal
Learn to Code and Code to Learn
Your Journey to Code Mastery
Example Input Input octal number: 172 Output Decimal number: 122 Logic to convert from octal to decimal
Example Input Input octal number: 172 Output Binary of 172: 01111010 Logic to convert octal to binary number system I have divided the octal to binary conversion in three steps. Extract last digit from octal number. Find binary equivalent of octal digit found above. Combine all converted binary together. Octal to Binary conversion table Decimal Octal…
Read More “C program to convert Octal to Binary number system” »
Example Input Enter binary number: 11000010 Output Hexadecimal: C2 Logic to convert binary to hexadecimal number system Binary to hexadecimal conversion algorithm is divided in two parts. Group all binary bits to 4 digits starting from right side. Write corresponding hexadecimal value of each grouped digit. Binary to hexadecimal conversion table Decimal Binary Hexadecimal 0…
Read More “C program to convert Binary to Hexadecimal number system” »
Example Input Input binary number: 00110111 Output Octal number: 67 Logic to convert Binary to Octal number system To make things simple and sound, I have divided the logic in two easy steps. Group all binary bits to 3 digits starting from right side. Write corresponding octal value for each grouped binary value. Binary to…
Read More “C program to convert Binary to Octal number system” »
Example Input Input number: 0011 Output Decimal: 3 Logic to convert binary to decimal number system Another approach using two’s complement
Example Input Input binary number: 01101110 Output Twos complement: 10010010 Twos complement of an <i>N</i>-bit number is defined as the complement with respect to 2<sup>N</sup>. It is the result of subtracting the number from 2<sup>N</sup>, which in binary is one followed by <i>N</i> zeroes. In simple words twos complement is defined as sum of ones complement of a binary number and…
Read More “C program to find twos complement of a binary number” »
Example Input Input binary number: 01000011 Output Ones complement: 10111100 Ones complement of a binary number is defined as value obtained by inverting all binary bits. It is the result of swapping all 1s to 0s and all 0s to 1s.
Example Input Input number of terms: 10 Output Fibonacci series: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 Fibonacci series is a series of numbers where the current number is the sum of previous two terms. For Example: 0, 1, 1, 2, 3, 5, 8, 13, 21, … , (n-1th + n-2th) Program to…
Read More “C program to print fibonacci series upto n terms” »
Example Input Input upper limit: 1000 Output Strong numbers between 1-1000: 1, 2, 145 Strong number is a special number whose sum of factorial of digits is equal to the original number. For example: 145 is strong number. Since, 1! + 4! + 5! = 145 Program to print strong numbers in given range
Example Input Input number: 145 Output 145 is STRONG NUMBER Strong number is a special number whose sum of factorial of digits is equal to the original number.For example: 145 is strong number. Since, 1! + 4! + 5! = 145