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
Tell me is null always defined as 0(zero)?
What is d scanf?
Explain the difference between the local variable and global variable in c?
What are the 5 data types?
write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.
How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?
What will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
How can a number be converted to a string?
What are header files in c?
What is the purpose of 'register' keyword in c language?
This is a variation of the call_me function in the previous question:call_me (myvar)int *myvar;{ *myvar += 5; }The correct way to call this function from main() will be a) call_me(myvar) b) call_me(*myvar) c) call_me(&myvar) d) expanded memory
Stimulate calculator using Switch-case-default statement for two numbers
What will the preprocessor do for a program?
What is the auto keyword good for?
If null and 0 are equivalent as null pointer constants, which should I use?