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
Difference between malloc() and calloc() function?
difference between Low, Middle, High Level languages in c ?
Explain void pointer?
What is double pointer in c?
Explain how can I manipulate strings of multibyte characters?
What is c language in simple words?
Is register a keyword in c?
Write a progarm to find the length of string using switch case?
Explain what is the concatenation operator?
In which header file is the null macro defined?
Why array is used in c?
what are the facialities provided by you after the selection of the student.
The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none
Why c is a procedural language?
What is unary operator?