Answer Posted / abhishek karnani
Here is a prgm to convert a decimal number to any base just
replace 2 by the base number of the desired number
#include<stdio.h>
#include<conio.h>
void main()
{
int d;
int i=0,n,j,b[100];
clrscr();
printf("\nEnter decimal number: ");
scanf("%d",&n);
while (n>0)
{
b[i]=n%2;
n=n/2;
i++;
}
printf("\nBinary is: ");
for (j=i-1;j>=0;j--)
{
printf("%d",b[j]);
}
getch();
}
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
How can I invoke another program or command and trap its output?
Write the syntax and purpose of a switch statement in C.
Explain null pointer.
What is a far pointer in c?
What is the translation phases used in c language?
What are runtime error?
How do you determine whether to use a stream function or a low-level function?
in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above
Sir,please help me out with the code of this question. Write an interactive C program that will encode or decode multiple lines of text. Store the encoded text within a data file, so that it can be retrieved and decoded at any time. The program should include the following features: (a) Enter text from the keyboard, encode the text and store the encoded text in a data file. (b) Retrieve the encoded text and display it in its encoded form. (c) Retrieve the encoded text, decode it and then display the decoded text. (d) End the computation. Test the program using several lines of text of your choice.
List out few of the applications that make use of Multilinked Structures?
What is this infamous null pointer, anyway?
What is scanf_s in c?
Why can’t constant values be used to define an array’s initial size?
How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?
Is c pass by value or reference?