2. Write a c program to convert decimal number to octal number.

3. Write a c program to convert decimal number to hexadecimal number.

4. Write a c program to convert octal number to binary number.

3. Write a c program to convert decimal number to hexadecimal number.

4. Write a c program to convert octal number to binary number.

6. Write a c program to convert octal number to hexadecimal number.

8. Write a c program to convert hexadecimal number to octal number.

9. Write a c program to convert hexadecimal number to decimal number.

10. Write a c program to convert binary number to octal number.

9. Write a c program to convert hexadecimal number to decimal number.

10. Write a c program to convert binary number to octal number.

12. Write a c program to convert binary number to hexadecimal number.

13. C program for addition of binary numbers .

14. C program for multiplication of two binary numbers.

15. C program fractional binary conversion from decimal.

16. C program for fractional decimal to binary fraction conversion.

17. C program to convert decimal number to roman.

18. C program to convert roman number to decimal number.

19. C program to convert each digits of a number in words

20. C program to convert currency or number in word.

13. C program for addition of binary numbers .

14. C program for multiplication of two binary numbers.

15. C program fractional binary conversion from decimal.

16. C program for fractional decimal to binary fraction conversion.

17. C program to convert decimal number to roman.

18. C program to convert roman number to decimal number.

19. C program to convert each digits of a number in words

20. C program to convert currency or number in word.

thanks to ur great effort........ur work has really been helpful to me n will always be grateful to u.....

ReplyDeletethanks!

aayush.

truly i feel great to come here

ReplyDeletevisit :C program to convert a binary number to decimal,octal and hexadecimal number and back

ReplyDeleteI see your algorithm logic for this uses value 'remainder' and your code declares a variable long int remainder; but this is unused in the program? I'm not sure why!

ReplyDeleteYes you are correct. No need to declare remainder. Thanks

ReplyDeleteThis comment has been removed by the author.

ReplyDeleteWhat about negative decimal numbers as input, will it work?

ReplyDeletewhat if the number has a fractional part?

ReplyDeletewtf its actually a good question.

Deleteits simple we can just take decimal part and multiply by 2. take reminder again multiply by 2. Repeat until we get 0

DeleteThis comment has been removed by the author.

ReplyDeletehow can i save the new binary number in a new array instead of printing it?

ReplyDeletethanks in advance

thankx for your help your solution was really very much helpful. i really felt great. Thankx

ReplyDeletehow can you convert a decimal array into binary one using recursion?

ReplyDeleteexample:

(decimal) 1,2,3,4,5 => (binary)0001,0010, 0011, 0100, 0101

dude,send me the answer if u have got it.

Deleteplz answer to olga kuzmin's question..

ReplyDeletethanks a lot sir! it helps me a lot!

ReplyDeleteWhat if the decimal number is 0? It won't enter the loop

ReplyDelete@olga====apply the conversion code in a for loop that trace throufh the array

ReplyDeleteThere is one 0 (zero) more than should be,in the code(last FOR):

ReplyDeletefor(j = i -1 ;j> 0;j--)

there should be J>1 not 0.

were should i put the clrscr(); ??? thanks

ReplyDeleteHello dear!!,

ReplyDeleteyou here printing one by one number. But when you should print it as a number!! Suppose, you need to use the binary conversion as a number,then your logic does not work.

Thanks.

#include

ReplyDelete#include

int main()

{ long int decimal,binr=0;

int bin=0,rem,i;

printf("enter the decimal number:");

scanf("%ld",&decimal);

for(i=1;decimal!=0;i++)

{ rem=decimal%2;

binr= binr*10 +rem;

decimal=decimal/2;

}

for(i=0;binr!=0;i++)

{ rem = binr%10;

bin= bin*10 +rem ;

binr=binr/10;

}

printf("the binary equivalent is: %ld",bin);

getch();

return 0;

}

This is a code with0ut using a array and can be used for decimal to octal num also anly the change is to make 8, where 2 is written.

#include

ReplyDeletevoid binary(int );

int main()

{

int n;

scanf("%d",&n);

binary(n);

return 0;

}

void binary(int p)

{

if(p==1)

printf("1");

else

{

binary(p/2);

printf("%d",p%2);

}

}

Hey, quick question about the value of i. Should the value of i be 100 and not 1. If it 1, the for loop with j would give an error? I'm confused about that.

ReplyDeleteNevermind. I got the point! Thanks!

Deletehow to write a program to print the boundary of a matrix

ReplyDeletewhy do i get this and each number of the binary is in a different line and how to fix it

ReplyDeletefor instance the number 4 shows as

1

0

0

This comment has been removed by the author.

ReplyDeleteThis comment has been removed by the author.

ReplyDelete#include

ReplyDelete#include

#define CHK_BIT(num,pos) (num&(0x01<<(pos-1)))

void dec2bin(int num);

main(){

int num;

printf("Enter the Number");

scanf("%d",&num);

dec2bin(num);

}

void dec2bin(int num){

int i;

for(i=31; i>0; i--){

if(CHK_BIT(num,i))

printf("1");

else

printf("0");

}

printf("\n");

}