Answer Posted / alle balraj
void main()
{
int i,n,p=0,j;
int a[10];
clrscr();
printf("Enter the value of n:\n");
scanf("%d",&n);
i=n;
while(i!=1)
{
if(n==1)
{
a[p]=1;
break;
}
if(n%2==0)
{
a[p]=n%2;
}
else
{
a[p]=n%2;
}
n=n/2;
i=n+2;
i--;
p++;
}
for(j=p;j>=0;j--)
{
printf("%d",a[j]);
}
getch();
}
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
What are the advantages of union?
how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12
Explain what is the difference between far and near ?
what are bit fields in c?
What is the purpose of sprintf() function?
What is const keyword in c?
What’s a signal? Explain what do I use signals for?
Can a local variable be volatile in c?
Explain what are preprocessor directives?
Are comments included during the compilation stage and placed in the EXE file as well?
Why functions are used in c?
What is the advantage of a random access file?
Is return a keyword in c?
What is self-referential structure in c programming?
How do you generate random numbers in C?