C Program to Convert Decimal to Binary using Bitwise AND operator

C Program to Convert Decimal to Binary using Bitwise and operator [crayon-62bec62e8386b384925343/] Output : [crayon-62bec62e83874371241691/] 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-62bec62e83878528147059/] Output : [crayon-62bec62e8387b003922509/] 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-62bec62e84421833064480/] Output : [crayon-62bec62e84428334621214/] 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-62bec62e8442c778188770/] 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-62bec62e84ae7039026247/] Output : [crayon-62bec62e84aee920204818/] Logic of This Program : In this program firstly we need to accept decimal number from the user using following statement - [crayon-62bec62e84af2237680007/] Now after accepting the number we are calling the function which can evaluate equivalent hexadecimal number. [crayon-62bec62e84af5413465906/] 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-62bec62e853c7987208930/] Output : [crayon-62bec62e853ce318635314/] Explanation of Program : Always Program execution starts from main function. Inside Main function we are accepting the decimal number. [crayon-62bec62e853d1984394021/] Now after accepting the input decimal number we pass the decimal number to function dec_bin(num) function using following syntax. [crayon-62bec62e853d4376502408/] 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 [...]