1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#include<stdio.h> #include<stdlib.h> int { int i,m; char numbers; while(scanf("%d%s%d",&i,numbers,&m)!=EOF) { long n; if(m==8) { printf("%o",strtol(numbers,NULL,i)); } else if(m==16) { printf("%X",n=strtol(numbers,NULL,i)); } printf("\n"); } return 0; } |
Pastie
