C Program to Convert Decimal to Binary using Bitwise AND operator

C Program to Convert Decimal to Binary using Bitwise and operator [crayon-581eb23b6c8ab280113069/] Output : [crayon-581eb23b6c8ea744946308/] Above program is just to know the size of integer variable in C Programming (Borland C/C++ Compiler.) Integer number can be represented by 16 bits. To convert the Decimal Number into Binary , Check First MSB bit of number , if it is 1 then display '1' otherwise display '0'. Program : [crayon-581eb23b6c8f8888321822/] Output : [crayon-581eb23b6c90d403559427/] Explanation of Decimal to Binary Program : In this program we have accepted the decimal number using [...]

C Program to Convert Binary to Decimal number

Program to Convert Binary to Decimal number:Number System  [crayon-581eb23b6ead5992003894/] Output : [crayon-581eb23b6eaea866016504/] Note :  This program is for beginners (not for Experts) that's why we haven't provided any Validations while accepting the input. Please provide proper binary input to this program i.e (0 and 1). Logic of This Program : In the main function we have accepted the proper binary input i.e suppose we have accepted 111 as binary input. [crayon-581eb23b6eaf9913864638/] Inside the function while loop gets executed. Sample Dry run for the while loop is shown [...]

C Program to Convert Decimal Number to Hexadecimal Number

C Program to Convert Decimal number into Hexadecimal : [crayon-581eb23b6f3bc241269383/] Output : [crayon-581eb23b6f3d1823238732/] Logic of This Program : In this program firstly we need to accept decimal number from the user using following statement - [crayon-581eb23b6f3dd233558100/] Now after accepting the number we are calling the function which can evaluate equivalent hexadecimal number. [crayon-581eb23b6f3ea792271103/] Inside the function we have declared 3 variables. Below table will explain the significance of each and every variable used inside the function.Now perform below steps until the number becomes less than 0 -Divide the [...]

C Program to Convert Decimal number to Octal Number

Logic of This Program : In this program we are accepting the decimal number from the user and decimal number is converted into the equivalent octal number with simple steps - [box] Steps to Convert Decimal to Octal :Accept the given decimal number If the number is less than 8 the octal number is the same If the num > 7 then Divide the number with 8 Write down the remainder Do steps 3 and 4 with the quotient till that quotient is less than 8 Write [...]

C Program to Convert Decimal number into Binary Number

Program to Convert Decimal number into Binary : Number System : Download [crayon-581eb23b7088f813175098/] Output : [crayon-581eb23b708a2037064964/] Explanation of Program : Always Program execution starts from main function. Inside Main function we are accepting the decimal number. [crayon-581eb23b708ae420000752/] Now after accepting the input decimal number we pass the decimal number to function dec_bin(num) function using following syntax. [crayon-581eb23b708ba831934230/] Inside the Function Call - We have declared some variables and the use of each variable is listed in following table -We are following steps until the number becomes 0 or less [...]