int to binary

hello guys this is my program this should convert int to binary however this does not work!! I will appreciate if anyone shows my failure



#include

int main()

{
int a;
int k ;
int i=0;
int *ptr;
scanf(&a);
printf(a);
function ();


for (k=0;k1){
remain=a%2;
*ptr=remain;
ptr++;
a=a/2;
i++;
}
else if (a=1){
remain=1;
*ptr=remain;
i++;}
else if (a=0){
remain=0;
*ptr=remain;
i++;
}}

Comments

  • : hello guys this is my program this should convert int to binary however this does not work!! I will appreciate if anyone shows my failure


    search these threads -- this has been posted several times.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion