# C Program to ConvertDecimaltoBinary using Bitwise Operator

## C Program to Convert Decimal into Binary using Bitwise Operator

This page has a C Program to Convert Decimal to Binary using Bitwise Operator. It is clear that, this C program will Convert Decimal to Binary using Bitwise Operator. For Example: If the Decimal number 27 is given as input, the program will print the binary equivalent as 11011 The below given C program is used to Convert Decimal to Binary using Bitwise OperatorKindly check out the program to Convert Decimal into Binary using Bitwise OperatorThe Questions to Convert Decimal number into Binary Number problem can be asked as . .

1). C Program to Convert Decimal number to Binary Number using Bitwise Operator.

2). C Program to Convert the given Decimal number into Binary Number using Bitwise Operator

3). C Program to find the Binary equivalent of given Decimal number using Bitwise Operator.

4). C Program to Print Binary Equivalent of a Decimal Integer using Bitwise Operator.

5). Program to convert decimal to binary in c using Bitwise Operator

### Decimal to Binary using Bitwise Operator Program - First Method

#include<stdio.h>
#include<conio.h>
void decimal_to_binary(unsigned int);
int main(){
unsigned int number;
clrscr();
printf("Enter a Decimal Number : ");
scanf("%u",&number);
decimal_to_binary(number);
getch();
return(0);
}
void decimal_to_binary(unsigned int n){
unsigned int range=32768;
printf("\n The Binary Eqivalent is ");
xy:
if(range > 0)
{
if((n & range) == 0 ){
range = range >> 1 ;
goto xy; }
else
while(range>0){
if((n & range) == 0 )
printf("0");
else
printf("1");
range = range >> 1 ;
}
}
}

### Decimal to Binary using Bitwise Operator Program - Second Method for very large Number

#include<stdio.h>
#include<conio.h>
void decimal_to_binary(unsigned long int);
int main(){
unsigned long int number;
clrscr();
printf("Enter a big decimal number : ");
scanf("%lu",&number);
decimal_to_binary(number);
getch();
return(0);
}
void decimal_to_binary(unsigned long int n){
unsigned long int range=2147483648;
printf("\n The Binary Eqivalent is ");
xy:
if(range > 0)
{
if((n & range) == 0 ){
range = range >> 1 ;
goto xy; }
else
while(range>0){
if((n & range) == 0 )
printf("0");
else
printf("1");
range = range >> 1 ;
}
}
}

Sample Output:

Enter an Integer decimal number : 13

The given decimal number is : 13

The Binary number is : 1101

### Related Other Popular C Programs

*  Write a c program to check whether a given number is prime number or not?

*  Write a C program to find the prime numbers between 1 and 100

*  Write a C program to display the prime numbers between a range ?

*  Write a C program to find the prime numbers between a range using while loop?

*  Write a C program to find the sum of prime numbers between a range

About Er. T.Tharesh Kumar

I am a Professor and Head of Department of Computer Science in an Arts and Science College. I have designed this website to provide solved example programs of different categories for all the school and college going students to learn C language deeply, and to practice Interview based Multiple Choice (Objective Type) questions and answers.