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 does c mean?
Describe the difference between = and == symbols in c programming?
Write a program to generate random numbers in c?
Why static variable is used in c?
Is c procedural or functional?
Write a program on swapping (100, 50)
What are the various types of control structures in programming?
please explain every phase in the "SDLC" in the dotnet.
What is hashing in c?
What is the use of function in c?
What are two dimensional arrays alternatively called as?
Where are the auto variables stored?
Are local variables initialized to zero by default in c?
Why malloc is faster than calloc?
how to print the character with maximum occurence and print that number of occurence too in a string given ?