Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- char hex2[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
- unsigned int test=0;
- int pos=0;
- while(scanf("%d",&test)){
- unsigned int temp=test;
- char hex[8]={0};
- while(temp>0){
- int remain=0;
- remain=temp & 15;
- printf("%d\n",remain);
- temp=temp>>4;
- hex[pos]=hex2[remain];
- pos++;
- }
- for(int prin=7;prin>=0;prin--){
- printf("%s",&hex[prin]);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement