Write a C program to convert any integer to its binary equivalent.

#include <stdio.h>
int main(){
int x,arr[16],i=0;
printf("Enter the integer value: ");
while(x > 0){
arr[i]= x % 2;
x = x/2;
for(i=i-1; i>=0; i--){
printf("%d ",arr[i]);
return 0;

Posted in CSE

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>