Search This Blog

Translate

c program for inter conversion of decimal,binary,octal,hexadecimal

conversion of decimal to binary octal and hexadecimal in c java,decimal binary octal hexadecimal conversion table,decimal binary octal hexadecimal conversion calculator, conversion of binary to decimal octal and hexadecimal pdf, binary decimal octal hexadecimal conversion chart,c program to convert decimal to binary octal and hexadecimal using functions,decimal binary octal hexadecimal formula,decimal binary octal hexadecimal number system,

c program for inter conversion of decimal, binary, octal, hexadecimal

#include"stdio.h"
#include"conio.h"
void main()
{
int n,n1,n2,rem,no,bin[15],oct[15],i=0,j,k=0,l=0;char hex[15];
clrscr();
printf("Enter the number=");
scanf("%d",&n);
no=n1=n2=n;
while(n>0)
{
bin[i++]=n%2;
n=n/2;

}
printf("\n\nBinary equivalent of %d is=",no);
for(j=i-1;j>=0;j--)
{
printf("%d",bin[j]);
}
while(n1>0)
{
oct[k++]=n1%8;
n1=n1/8;

}
printf("\n\nOctal equivalent of %d is=",no);
for(j=k-1;j>=0;j--)
{
printf("%d",oct[j]);
}
while(n2>0)
{
rem=n2%16;
if(rem>=10)
{
switch(rem)
{
case 10:hex[l++]=65;
n2=n2/16;
break;
case 11:hex[l++]=66;
n2=n2/16;
break;
case 12:hex[l++]=67;
n2=n2/16;
break;
case 13:hex[l++]=68;
n2=n2/16;
break;
case 14:hex[l++]=69;
n2=n2/16;
break;
case 15:hex[l++]=70;
n2=n2/16;
break;
}
}
else
{
 rem=rem+48;
 hex[l++]=rem;
 n2=n2/16;
}
}
printf("\n\nHexadecimal equivalent of %d is=",no);
for(j=l-1;j>=0;j--)
{
printf("%c",hex[j]);
}

getch();
}

conversion of decimal to binary octal and hexadecimal in c java,decimal binary octal hexadecimal conversion table,decimal binary octal hexadecimal conversion calculator, conversion of binary to decimal octal and hexadecimal pdf, binary decimal octal hexadecimal conversion chart,c program to convert decimal to binary octal and hexadecimal using functions,decimal binary octal hexadecimal formula,decimal binary octal hexadecimal number system,


C Program example List

Google+ Badge