Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- char in[1000];
- struct{int carry;int times;} list[] = { {0,0}, {20,3}, {40,6}, {60,9}, {10,2}, {30,5}, {50,8}, {0,1}, {20,4}, {40,7} };
- printf("Target: ");
- gets(in);
- int target = strtol( in, 0, 10 ), j, i,save[4];
- for( i = 3; i >= 0; --i ){
- j = target - target / 10 * 10;
- save[i] = list[j].times;
- target = ( target - list[j].carry ) / 10;
- }
- for( i = 0; i < 4; ++i )
- printf("%i%c", save[i], i < 3 ? '>' : ' ' );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement