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.
3 comments:
why do you use char to store the binary value
#include
#include
int main()
{
int n,m[100],i=0,j=0,x=0,l[100],k;
printf("enter octal number:");
scanf("%d",&n);
printf("\n");
while(n>0)
{
m[i]=n%10;
x+=m[i]*pow(8,i);
n=n/10;
i++;
}
printf("decimal equivalent is : %d\n",x);
printf("HEXA DECIMAL equivalent is:");
while(x>0)
{
l[j++]=x%16;
//printf("%d ",l[j++]);
x=x/16;
}
for(k=j-1;k>=0;k--)
{
if(l[k]==10)
printf("A ");
else if(l[k]==11)
printf("B ");
else if(l[k]==12)
printf("C ");
else if(l[k]==13)
printf("D ");
else if(l[k]==14)
printf("E ");
else if(l[k]==15)
printf("F ");
else
printf("%d ",l[k]);
}
}
#include
#include
#include
/**hexa decimal to octal conversion**/
int main()
{
char h[100];
int i = 0, val, len;
int dec = 0;
int place = 1;
int j=0,m[100];
printf("Enter any hexadecimal number: ");
gets(h);
len = strlen(h);
len--;
for(i=0; h[i]!='\0'; i++)
{
switch(h[i])
{
case '0':
val = 0;
break;
case '1':
val = 1;
break;
case '2':
val = 2;
break;
case '3':
val = 3;
break;
case '4':
val = 4;
break;
case '5':
val = 5;
break;
case '6':
val = 6;
break;
case '7':
val = 7;
break;
case '8':
val = 8;
break;
case '9':
val = 9;
break;
case 'a':
case 'A':
val = 10;
break;
case 'b':
case 'B':
val = 11;
break;
case 'c':
case 'C':
val = 12;
break;
case 'd':
case 'D':
val = 13;
break;
case 'e':
case 'E':
val = 14;
break;
case 'f':
case 'F':
val = 15;
break;
}
dec+= val * pow(16, len);
len--;
}
printf("\nHexadecimal number = %s\n", h);
printf("Decimal number = %lld", dec);
printf("\noctal equivalent of hexa decimal is:");
while(dec>0)
{
m[j++]=dec%8;
dec=dec/8;
}
for(i=j-1;i>=0;i--)
{
printf("%d ",m[i]);
}
}
Post a Comment