Skip to main content
deleted 7 characters in body
Source Link
owacoder
  • 1.6k
  • 8
  • 13

C, 132 116 113 8780

t,c;f(char*v){t=*v==45;c=atoifor(v+=t);forc=atoi(c=t?-c:c;*v;c+=tv+=t=*v==45);*v;t=0,++v)c+=t?50-*v-2*c:*v-47,++v)t=0;return47;return c;} 

Function f() takes the input as a string and returns the result as an integer. Full program version (113 bytes):

maint;main(int c,char**v){char*p=v[1],t=*p==45;c=atoichar*p=v[1];c=atoi(p+=tp+=t=*p==45);for(c=t?-c:c;*p;c+=tc;*p;++p,t=0)c+=t?50-*p:*p-47,++p)t=0;printf47;printf("%d\n",c);} 

Requires one argument.

C, 132 116 113 87

t,c;f(char*v){t=*v==45;c=atoi(v+=t);for(c=t?-c:c;*v;c+=t?50-*v:*v-47,++v)t=0;return c;} 

Function f() takes the input as a string and returns the result as an integer. Full program version (113 bytes):

main(int c,char**v){char*p=v[1],t=*p==45;c=atoi(p+=t);for(c=t?-c:c;*p;c+=t?50-*p:*p-47,++p)t=0;printf("%d\n",c);} 

Requires one argument.

C, 132 116 113 80

t,c;f(char*v){for(c=atoi(v+=t=*v==45);*v;t=0,++v)c+=t?50-*v-2*c:*v-47;return c;} 

Function f() takes the input as a string and returns the result as an integer. Full program version (113 bytes):

t;main(int c,char**v){char*p=v[1];c=atoi(p+=t=*p==45);for(c=t?-c:c;*p;++p,t=0)c+=t?50-*p:*p-47;printf("%d\n",c);} 

Requires one argument.

added 223 characters in body
Source Link
owacoder
  • 1.6k
  • 8
  • 13

C, 132 116 113113 87

t,c;f(char*v){t=*v==45;c=atoi(v+=t);for(c=t?-c:c;*v;c+=t?50-*v:*v-47,++v)t=0;return c;} 

Function f() takes the input as a string and returns the result as an integer. Full program version (113 bytes):

main(int c,char**v){char*p=v[1],t=*p==45;c=atoi(p+=t);for(c=t?-c:c;*p;c+=t?50-*p:*p-47,++p)t=0;printf("%d\n",c);} 

Requires one argument.

C, 132 116 113

main(int c,char**v){char*p=v[1],t=*p==45;c=atoi(p+=t);for(c=t?-c:c;*p;c+=t?50-*p:*p-47,++p)t=0;printf("%d\n",c);} 

Requires one argument.

C, 132 116 113 87

t,c;f(char*v){t=*v==45;c=atoi(v+=t);for(c=t?-c:c;*v;c+=t?50-*v:*v-47,++v)t=0;return c;} 

Function f() takes the input as a string and returns the result as an integer. Full program version (113 bytes):

main(int c,char**v){char*p=v[1],t=*p==45;c=atoi(p+=t);for(c=t?-c:c;*p;c+=t?50-*p:*p-47,++p)t=0;printf("%d\n",c);} 

Requires one argument.

added 9 characters in body
Source Link
owacoder
  • 1.6k
  • 8
  • 13

C, 132 116116 113

main(int c,char**v){char*p=v[1],t=*p==45;c=atoi(p+=t);c=t;for(c=t?-c:c;while(*p)c+=tc;*p;c+=t?50-*p:*p-47,++p,)t=0;printf("%d\n",c);} 

Requires one argument.

C, 132 116

main(int c,char**v){char*p=v[1],t=*p==45;c=atoi(p+=t);c=t?-c:c;while(*p)c+=t?50-*p:*p-47,++p,t=0;printf("%d\n",c);} 

Requires one argument.

C, 132 116 113

main(int c,char**v){char*p=v[1],t=*p==45;c=atoi(p+=t);for(c=t?-c:c;*p;c+=t?50-*p:*p-47,++p)t=0;printf("%d\n",c);} 

Requires one argument.

Saved some bytes.
Source Link
owacoder
  • 1.6k
  • 8
  • 13
Loading
Source Link
owacoder
  • 1.6k
  • 8
  • 13
Loading