Timeline for Count up diagonally!
Current License: CC BY-SA 3.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 12, 2019 at 21:22 | comment | added | ceilingcat | 55 bytes | |
Aug 2, 2017 at 20:31 | comment | added | Asleepace | Ahhh your right forgot about log10 on 0 and negatives, I've updated the solution thanks! | |
Aug 2, 2017 at 20:31 | history | edited | Asleepace | CC BY-SA 3.0 |
added 68 characters in body
|
Aug 2, 2017 at 10:42 | comment | added | falken |
Last one: both s and i can be combined into a single int declaration, saving two more bytes. Here's the final code: f(a,b){int s=0,i;while(a<=b){i=s;while(i--)printf(" ");s+=printf("%i\n",a++)-1;}}
|
|
Aug 2, 2017 at 10:33 | comment | added | falken |
Also, it looks like this fails if the starting number is zero. Fortunately that can be fixed and the code can be made even shorter by using the return value of printf, like so: s+=printf("%i\n",a)-1;
|
|
Aug 2, 2017 at 10:25 | comment | added | falken |
Using int i=s;while(i--) instead of for(int i=0;i<s;i++) for the inner loop will save two bytes.
|
|
Aug 1, 2017 at 17:58 | comment | added | Asleepace | Ahh your right thanks, I updated the post! | |
Aug 1, 2017 at 17:57 | history | edited | Asleepace | CC BY-SA 3.0 |
deleted 1 character in body
|
Aug 1, 2017 at 13:29 | comment | added | Adalynn |
I think you can move the int s=0 to the for loop, as in for(int s=0;a<=b;a++) .
|
|
Aug 1, 2017 at 6:20 | history | edited | Asleepace | CC BY-SA 3.0 |
added 138 characters in body
|
Aug 1, 2017 at 6:10 | history | edited | Asleepace | CC BY-SA 3.0 |
added 27 characters in body
|
Aug 1, 2017 at 6:03 | history | edited | Asleepace | CC BY-SA 3.0 |
added 268 characters in body
|
Aug 1, 2017 at 0:20 | history | edited | Asleepace | CC BY-SA 3.0 |
added 64 characters in body
|
Aug 1, 2017 at 0:14 | comment | added | Stephen |
Welcome to PPCG! I believe you can rename argc and argv to one letter variables.
|
|
Aug 1, 2017 at 0:12 | review | First posts | |||
Aug 1, 2017 at 0:14 | |||||
Aug 1, 2017 at 0:07 | history | answered | Asleepace | CC BY-SA 3.0 |