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
Why pointers are used in c?
Is it possible to initialize a variable at the time it was declared?
What is the modulus operator?
What is the maximum no. of arguments that can be given in a command line in C.?
What does struct node * mean?
What is nested structure?
What is pass by reference in c?
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?
Is null equal to 0 in sql?
What is a good way to implement complex numbers in c?
What are the c keywords?
What is the use of f in c?
What is difference between structure and union in c?
What is openmp in c?
Write a program to print "hello world" without using a semicolon?