Skip to main content
Amended solutions according to comments; then corrected formatting
Source Link
Alchymist
  • 554
  • 2
  • 7

C 64 6363 56 or 61

If the input can be piped from file

main(a){while(scanf("%d",&a)>0)putchar(48+(a-a/10)%10);} 

If the input should be typed to stdin

i;main(a){for(;i++-4;printf4;putchar("%d",48+(a-a/10)%10))scanf("%d",&a);} 

Reads the four numbers in a loop and then processes each by subtracting the first digit from the value and printing the result modulo 10.

Savings thanks to various comments below and also using putchar instead of printf

C 64 63

a,i;main(){for(;i++-4;printf("%d",(a-a/10)%10))scanf("%d",&a);} 

Reads the four numbers in a loop and then processes each by subtracting the first digit from the value and printing the result modulo 10.

C 64 63 56 or 61

If the input can be piped from file

main(a){while(scanf("%d",&a)>0)putchar(48+(a-a/10)%10);} 

If the input should be typed to stdin

i;main(a){for(;i++-4;putchar(48+(a-a/10)%10))scanf("%d",&a);} 

Reads the four numbers in a loop and then processes each by subtracting the first digit from the value and printing the result modulo 10.

Savings thanks to various comments below and also using putchar instead of printf

Moved scan out of loop to save a comma
Source Link
Alchymist
  • 554
  • 2
  • 7

C 6464 63

a,i;main(){for(;i++-4;scanf("%d",&a),printf4;printf("%d",(a-a/10)%10))scanf("%d",&a);} 

Reads the four numbers in a loop and then processes each by subtracting the first digit from the value and printing the result modulo 10.

C 64

a,i;main(){for(;i++-4;scanf("%d",&a),printf("%d",(a-a/10)%10));} 

Reads the four numbers in a loop and then processes each by subtracting the first digit from the value and printing the result modulo 10.

C 64 63

a,i;main(){for(;i++-4;printf("%d",(a-a/10)%10))scanf("%d",&a);} 

Reads the four numbers in a loop and then processes each by subtracting the first digit from the value and printing the result modulo 10.

Source Link
Alchymist
  • 554
  • 2
  • 7

C 64

a,i;main(){for(;i++-4;scanf("%d",&a),printf("%d",(a-a/10)%10));} 

Reads the four numbers in a loop and then processes each by subtracting the first digit from the value and printing the result modulo 10.