Search found 1 match

by voidptr
Mon Jul 02, 2012 9:07 pm
Forum: Challenges Solved
Topic: Valuation
Replies: 103
Views: 9347

Simple in C

I wrote a little command line utility in C: #include <stdio.h> int main(int argc, char *argv[]) { int x, y, n; char *p; while (--argc) { for (p = *++argv, x=y=n=0; *p; p++) if (*p == 'x') n += x+y; else { x = y; y = *p-'0'; n += y; } printf("%s = %d\n", *argv, n); } return 0; } Just pass t...