C (gcc), (削除) 29 (削除ここまで) 27(削除) 27 (削除ここまで) 25 bytes
f(i){i=i%10+(ii=i?fi%10+f(i/10):0);0;}
-2 bytes thanks to Giuseppe
-2 bytes thanks to c--
Takes input as int.
C's int isn't large enough for the last test case.
The bracket around the ternary is truly awful. Wish I could remove that(削除) The bracket around the ternary is truly awful. Wish I could remove that. (削除ここまで) Thanks c-- again.
C (gcc), (削除) 38 (削除ここまで) 36 bytes (no recursion).
a;f(i){for(a=0;i;i/=10)a+=i%10;a=a;}
-2 bytes thanks to Giuseppe
Takes input as int.
C's int isn't large enough for the last test case.
C (gcc), 56 bytes (no recursion) (outgolfed by c-- using recursion).
a,n;f(char*s){for(a=0,n=strlen(s);n--;++s)a+=*s-48;a=a;}
Takes input as string
C (gcc), (削除) 29 (削除ここまで) 27 bytes
f(i){i=i%10+(i?f(i/10):0);}
-2 bytes thanks to Giuseppe
Takes input as int.
C's int isn't large enough for the last test case.
The bracket around the ternary is truly awful. Wish I could remove that.
C (gcc), (削除) 38 (削除ここまで) 36 bytes (no recursion).
a;f(i){for(a=0;i;i/=10)a+=i%10;a=a;}
-2 bytes thanks to Giuseppe
Takes input as int.
C's int isn't large enough for the last test case.
C (gcc), 56 bytes (no recursion) (outgolfed by c-- using recursion).
a,n;f(char*s){for(a=0,n=strlen(s);n--;++s)a+=*s-48;a=a;}
Takes input as string
C (gcc), (削除) 29 (削除ここまで) (削除) 27 (削除ここまで) 25 bytes
f(i){i=i?i%10+f(i/10):0;}
-2 bytes thanks to Giuseppe
-2 bytes thanks to c--
Takes input as int.
C's int isn't large enough for the last test case.
(削除) The bracket around the ternary is truly awful. Wish I could remove that. (削除ここまで) Thanks c-- again.
C (gcc), (削除) 38 (削除ここまで) 36 bytes (no recursion).
a;f(i){for(a=0;i;i/=10)a+=i%10;a=a;}
-2 bytes thanks to Giuseppe
Takes input as int.
C's int isn't large enough for the last test case.
C (gcc), 56 bytes (no recursion) (outgolfed by c-- using recursion).
a,n;f(char*s){for(a=0,n=strlen(s);n--;++s)a+=*s-48;a=a;}
Takes input as string
C (gcc), 29 bytes (using recursion)(削除) 29 (削除ここまで) 27 bytes
f(i){i=i%10+(i/1?f(i/10):0);}
-2 bytes thanks to Giuseppe
Takes input as int.
C's int isn't large enough for the last test case.
The bracket around the ternary is truly awful. Wish I could remove that.
C (gcc), 38(削除) 38 (削除ここまで) 36 bytes (no recursion).
a;f(i){for(a=0;i/1;ia=0;i;i/=10)a+=i%10;a=a;}
-2 bytes thanks to Giuseppe
Takes input as int.
C's int isn't large enough for the last test case.
C (gcc), 56 bytes (no recursion) (outgolfed by c-- using recursion).
a,n;f(char*s){for(a=0,n=strlen(s);n--;++s)a+=*s-48;a=a;}
Takes input as string
C (gcc), 29 bytes (using recursion)
f(i){i=i%10+(i/1?f(i/10):0);}
Takes input as int.
C's int isn't large enough for the last test case.
The bracket around the ternary is truly awful. Wish I could remove that.
C (gcc), 38 bytes (no recursion).
a;f(i){for(a=0;i/1;i/=10)a+=i%10;a=a;}
Takes input as int.
C's int isn't large enough for the last test case.
C (gcc), 56 bytes (no recursion) (outgolfed by c-- using recursion).
a,n;f(char*s){for(a=0,n=strlen(s);n--;++s)a+=*s-48;a=a;}
Takes input as string
C (gcc), (削除) 29 (削除ここまで) 27 bytes
f(i){i=i%10+(i?f(i/10):0);}
-2 bytes thanks to Giuseppe
Takes input as int.
C's int isn't large enough for the last test case.
The bracket around the ternary is truly awful. Wish I could remove that.
C (gcc), (削除) 38 (削除ここまで) 36 bytes (no recursion).
a;f(i){for(a=0;i;i/=10)a+=i%10;a=a;}
-2 bytes thanks to Giuseppe
Takes input as int.
C's int isn't large enough for the last test case.
C (gcc), 56 bytes (no recursion) (outgolfed by c-- using recursion).
a,n;f(char*s){for(a=0,n=strlen(s);n--;++s)a+=*s-48;a=a;}
Takes input as string
C (gcc), 29 bytes (using recursion)
f(i){i=i%10+(i/1?f(i/10):0);}
Takes input as int.
C's int isn't large enough for the last test case.
The bracket around the ternary is truly awful. Wish I could remove that.
C (gcc) , 38 bytes (takes input by intno recursion).
a;f(i){for(a=0;i/1;i/=10)a+=i%10;a=a;}
Takes input as int.
C's int isn't large enough for the last test case.
C (gcc), 56 bytes (takes input as stringno recursion) (outgolfed by c-- using recursion).
a,n;f(char*s){for(a=0,n=strlen(s);n--;++s)a+=*s-48;a=a;}
Takes input as string
C (gcc), 29 bytes (using recursion)
f(i){i=i%10+(i/1?f(i/10):0);}
Takes input as int.
C's int isn't large enough for the last test case.
The bracket around the ternary is truly awful. Wish I could remove that.
C (gcc) , 38 bytes (no recursion).
a;f(i){for(a=0;i/1;i/=10)a+=i%10;a=a;}
Takes input as int.
C's int isn't large enough for the last test case.
C (gcc), 56 bytes (no recursion) (outgolfed by c-- using recursion).
a,n;f(char*s){for(a=0,n=strlen(s);n--;++s)a+=*s-48;a=a;}
Takes input as string