Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

C: 150 138 - (100+50) = -12

a,b,c;main(d){for(scanf("%d ",&a);~scanf("%c%d ",&d,&b);a=d^43?d%5?d%2?a/b:a*b:a-b:a+b);for(;a;)for(b=a--;b;b/=10)c+=b%10;printf("%d",c);}

Very shamefully stealing @Fors answer from here to do the expression evaluation: http://codegolf.stackexchange.com/a/11423/13877https://codegolf.stackexchange.com/a/11423/13877

Sample usage:

./a.exe <<< "5 + 7"
51

Note: the expression implementation assumes no operator precedence and consumes values as it receives them; ex, 1+2*3 = 9 rather than the typical 7.

C: 150 138 - (100+50) = -12

a,b,c;main(d){for(scanf("%d ",&a);~scanf("%c%d ",&d,&b);a=d^43?d%5?d%2?a/b:a*b:a-b:a+b);for(;a;)for(b=a--;b;b/=10)c+=b%10;printf("%d",c);}

Very shamefully stealing @Fors answer from here to do the expression evaluation: http://codegolf.stackexchange.com/a/11423/13877

Sample usage:

./a.exe <<< "5 + 7"
51

Note: the expression implementation assumes no operator precedence and consumes values as it receives them; ex, 1+2*3 = 9 rather than the typical 7.

C: 150 138 - (100+50) = -12

a,b,c;main(d){for(scanf("%d ",&a);~scanf("%c%d ",&d,&b);a=d^43?d%5?d%2?a/b:a*b:a-b:a+b);for(;a;)for(b=a--;b;b/=10)c+=b%10;printf("%d",c);}

Very shamefully stealing @Fors answer from here to do the expression evaluation: https://codegolf.stackexchange.com/a/11423/13877

Sample usage:

./a.exe <<< "5 + 7"
51

Note: the expression implementation assumes no operator precedence and consumes values as it receives them; ex, 1+2*3 = 9 rather than the typical 7.

added 156 characters in body
Source Link
Josh
  • 2.8k
  • 1
  • 17
  • 25

C: 150 138 - (100+50) = -12

a,b,c;main(d){for(scanf("%d ",&a);~scanf("%c%d ",&d,&b);a=d^43?d%5?d%2?a/b:a*b:a-b:a+b);for(;a;)for(b=a--;b;b/=10)c+=b%10;printf("%d",c);}

Very shamefully stealing @Fors answer from here to do the expression evaluation: http://codegolf.stackexchange.com/a/11423/13877

Sample usage:

./a.exe <<< "5 + 7"
51

Note: the expression implementation assumes no operator precedence and consumes values as it receives them; ex, 1+2*3 = 9 rather than the typical 7.

C: 150 138 - (100+50) = -12

a,b,c;main(d){for(scanf("%d ",&a);~scanf("%c%d ",&d,&b);a=d^43?d%5?d%2?a/b:a*b:a-b:a+b);for(;a;)for(b=a--;b;b/=10)c+=b%10;printf("%d",c);}

Very shamefully stealing @Fors answer from here to do the expression evaluation: http://codegolf.stackexchange.com/a/11423/13877

Sample usage:

./a.exe <<< "5 + 7"
51

C: 150 138 - (100+50) = -12

a,b,c;main(d){for(scanf("%d ",&a);~scanf("%c%d ",&d,&b);a=d^43?d%5?d%2?a/b:a*b:a-b:a+b);for(;a;)for(b=a--;b;b/=10)c+=b%10;printf("%d",c);}

Very shamefully stealing @Fors answer from here to do the expression evaluation: http://codegolf.stackexchange.com/a/11423/13877

Sample usage:

./a.exe <<< "5 + 7"
51

Note: the expression implementation assumes no operator precedence and consumes values as it receives them; ex, 1+2*3 = 9 rather than the typical 7.

added 63 characters in body
Source Link
Josh
  • 2.8k
  • 1
  • 17
  • 25

C: 150 150 138 - (100+50) = 0-12

d;maina,b,c;main(cd){float a,b;forfor(scanf("%f"%d ",&a);~scanf("%c%f"%c%d ",&c&d,&b);a=c^43;a=d^43?c%5d%5?c%2d%2?a/b:a*b:a-b:a+b);for(;a;)for(b=a--;b;b/=10)d+=fmod(b,10);printfc+=b%10;printf("%d",dc);}

Very shamefully stealing @Fors answer from here to do the expression evaluation: http://codegolf.stackexchange.com/a/11423/13877

Sample usage:

./a.exe <<< "5 + 7"
51

C: 150 - (100+50) = 0

d;main(c){float a,b;for(scanf("%f ",&a);~scanf("%c%f ",&c,&b);a=c^43?c%5?c%2?a/b:a*b:a-b:a+b);for(;a;)for(b=a--;b;b/=10)d+=fmod(b,10);printf("%d",d);}

Very shamefully stealing @Fors answer from here to do the expression evaluation: http://codegolf.stackexchange.com/a/11423/13877

C: 150 138 - (100+50) = -12

a,b,c;main(d){for(scanf("%d ",&a);~scanf("%c%d ",&d,&b);a=d^43?d%5?d%2?a/b:a*b:a-b:a+b);for(;a;)for(b=a--;b;b/=10)c+=b%10;printf("%d",c);}

Very shamefully stealing @Fors answer from here to do the expression evaluation: http://codegolf.stackexchange.com/a/11423/13877

Sample usage:

./a.exe <<< "5 + 7"
51
Post Undeleted by Josh
added 200 characters in body
Source Link
Josh
  • 2.8k
  • 1
  • 17
  • 25
Loading
Post Deleted by Josh
Source Link
Josh
  • 2.8k
  • 1
  • 17
  • 25
Loading