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.

ok now the question is , what if I post 123 , or 2985 , in base of 2. Eventually, This isn't binary (base of 2 , combination os 1s and 0s). what code to use to make the program know its not a binary code ?

ReplyDeleteWho on earth would do that if it is clearly mentioned to input binary?

DeleteI can't understand this program please explain with step

ReplyDeleteA very simple and easy steps to understand please keep on posting such new concept. Also try to explain single example with different types of logic if available.

ReplyDeletewhat does the "j" stand for?

ReplyDeletej is used as "base"

ReplyDeleteinitially it is 1.

After first iteration it will be 1*2=2

After second iteration it will be 2*2=4 and so on..

#include

ReplyDeleteint main()

{

int num, x = 0, y = 0, z = 1;

printf("Enter Your Number: ");

scanf("%i", &num);

while(num > 0)

{

x = num % 10;

y = y + (x * z);

z = z * 2;

num = num / 10;

}

printf("%i", y);

getchar();

return 0;

}

#include

ReplyDeleteint main()

{

int num = 1101, x = 0, y = 0, z = 1;

//printf("Enter Your Number: ");

//scanf("%i", &num);

while(num > 0)

{

x = num % 10;

y = y + (x * z);

z = z * 2;

num = num / 10;

}

printf("%i", y);

getchar();

return 0;

}

THANKS FOR HELP US.

ReplyDelete#include

ReplyDelete#include

int main()

{

int dec=0,bin,rem,i=0;

printf("Enter the binary number (0,1): ");

scanf("%d",&bin);

while(bin!=0)

{

rem=bin%10;

dec+=rem*(pow(2,i));

i++;

bin=bin/10;

}

printf("\nDecimal value is= %d\n",dec);

return 0;

}

This comment has been removed by the author.

ReplyDeleteTime Limit Exceeded. how to improve this algorithm

ReplyDeleteUse bitwise operators!

Deletehow do i go about with binary numbers consisting of decimals? example: 1011.11

ReplyDeleteGood. Thank you

ReplyDeletehow to limit to only 5 bits. for example ( it i enter more than 5 bits of binary number it will show me "do it again", and if it is lees or equal to 5 bits will work).

ReplyDeletethanks

When I enter bin value = 10 000 000 000, it'll show decimal value = 1824 which is wrong.

ReplyDeleteI don't understand.

cool

ReplyDeleteI came across this easy program which I found quite interesting!

ReplyDelete#include

int power_func(int c,int d)

{

int value=1;

int count=1;

while(count<=d)

{

value=value*c;

count++;

}

return value;

}

void main()

{

int bin_num[15];

int digit_count,dec_num=0;

int a=0,i;

printf("\nEnter The Number of Digits in Binary Number:\t");

scanf("%d",&digit_count);

printf("\nEnter Binary Digits One After Another:\n");

for(i=0;i=0;i--)

{

dec_num=(bin_num[i]*power_func(2,a))+dec_num;

a++;

}

printf("\nDecimal Equivalent of Binary Number:\t %d",dec_num);

printf("\n");

}

Source: http://www.codingalpha.com/convert-binary-to-decimal-c-program/

you can find similar program in this link :- http://www.programmersinterview.com/2015/10/java-program-convert-binary-to-decimal.html

ReplyDeleteclick here to goto

Deletefind similar program here Click here

ReplyDelete