source file name: Conv16.C
void main()
{
int i,n;
int rem[15];;
clrscr();
printf("\n enteu any Natural number :\n");
scanf("%d",&n);
i=0;
while(n>0)
{
rem[i]=n%16;
n=n/16;
i++;
}
printf("\n Octal Conversion :\n");
for(i=i-1;i>=0;i--)
{
switch(rem[i])
{
case 10:printf("A ");break;
case 11:printf("B ");break;
case 12:printf("C ");break;
case 13:printf("D ");break;
case 14:printf("E ");break;
case 15:printf("F ");break;
default: printf(" %d ",rem[i]);break;
}
}
getch();
}
output:
0 Comments
Post a Comment