Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <math.h>
- int main()
- {
- int i,st=0,j=0,sum=0;
- char code[10000]={'\0'};
- gets(code);
- int n;
- n=strlen(code);
- for(i=0;i<n;i++)
- {
- if(code[i]<48 || i==n-1)
- {
- sum=0;
- int run=0;
- if(i==n-1) j=i;
- else j=i-1;
- for(j;j>=st;j--)
- {
- if(code[j]>='0' && code[j]<='9')
- {
- sum+=(code[j]-'0')*pow(16,run);
- }
- else
- {
- sum+=((code[j]-'a')+10)*pow(16,run);
- }
- run++;
- }
- printf("%d ",sum);
- st=i+1;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement