#include<stdio.h>
int main()
{
int dnum, temp, rem,i =1,j;
char hnum[50];
printf("Enter a Number \n");
scanf("%d",&dnum);
temp = dnum;
while(temp != 0 ) {
rem = temp % 16 ;
if( rem < 10 )
rem = rem + 48 ;
else
rem = rem + 55 ;
hnum[i++] = rem ;
temp = temp /16;
}
printf("Hexadecimal Number of the %d = ",dnum);
for( j = i - 1; j > 0; j-- )
printf("%c", hnum[j]);
return 0;
}
No comments:
Post a Comment