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.

## 16 comments:

i want examples of programs using bitwise operators..(like left shift,right shift etc)

while(binary1!=0||binary2!=0)

this can be efficiently written as

while(binary1||binary2)

Also what happens if the numbers are negative ?

Where is the validation for the given number is binary or not.

please help me with c or c++ program that can do addition of two number in octel notation,that is base8.

there is my code:

#include

#include

int main(){

long int octel1,octel2;

int i=0,remainder = 0,sum[20];

printf("Enter any first octel number: ");

scanf("%ld",&octel1);

printf("Enter any second octel number: ");

scanf("%ld",&octel2);

while(octel1!=0||octel2!=0){

sum[i++] = (octel1 %10 + octel2 %10 + remainder ) %8;

remainder = (octel1 %10 + octel2 %10 + remainder ) / 8;

octel1 = octel1/10;

octel2 = octel2/10;

}

if(remainder!=0)

sum[i++] = remainder;

--i;

printf("Sum of two octel numbers: ");

while(i>=0)

printf("%d",sum[i--]);

system("pause");

return 0;

}

it is very urgent. thanks in advance

you have to delete one #include, then make the other #include an #include stdio.h, and (sorry for my bad english) less than and greater than symbols must be put before and after the stdio.h word, I don't know why but i can't use them here.

void adder(int a,int b,int ci){

int na,nb,s;

if ((a==0) && (b==0)){printf("%d ",ci); return;}

na=a%10;

nb=b%10;

if((na==1)&& (nb==1) && (ci==1)){

s=1; ci=1;}

if (((na==0)&&(nb==0)&&(ci==1))||

((na==0)&&(nb==1)&&(ci==0))||

((na==1)&&(nb==0)&&(ci==0))){

s=1;

ci=0;}

if (((na==0)&&(nb==1)&&(ci==1))||

((na==1)&&(nb==0)&&(ci==1))||

((na==1)&&(nb==1)&&(ci==0)))

{s=0; ci=1;}

adder(a/10,b/10,ci);

printf("%d ",s);

}

Rule of binary addition:

1 + 1 = 0 (not 1 as u mentioned) and carry = 1

can I do it without using array /

?

can you reply c code for subtraction of 2 unsigned integer binary number.... thnx in adv :D

why the --i ???

Can u please help me how to write a program to find the carry, sum, and checksum of 4 16-bit binary numbers. The input and

output will be in binary format. Please do error checking for non-binary number.

try to add 1, and 10 ... ;) it will not work

It can be solved without using array with the help of recursion.Also the above code won't work if both the inputs are '0'

For ex: '000000' , '0000'

#include

void add(long int bin1,long int bin2,int remainder)

{

int sum;

if(bin1==0&&bin2==0)

{

printf("%d ",bin1);

return;

}

sum=(bin1%10 +bin2%10 +remainder)%2;

remainder=(bin1%10 +bin2%10 +remainder)/2;

bin1/=10;

bin2/=10;

add(bin1,bin2,remainder);

if(remainder!=0&&bin1==0&&bin2==0)

printf("%d ",remainder);

printf("%d ",sum);

}

int main()

{

long int bin1,bin2;

int i=0,j=0;

scanf("%ld %ld",&bin1,&bin2);

add(bin1,bin2,0);

return 0;

}

Post a Comment