Skip to main content

Timeline for Test a number for narcissism

Current License: CC BY-SA 3.0

12 events
when toggle format what by license comment
Nov 9, 2016 at 23:00 history edited Aryaman CC BY-SA 3.0
deleted 160 characters in body
Nov 9, 2016 at 19:15 comment added DJMcMayhem No that's not what I meant. I meant you don't need to print anything. Returning is a valid form of output. You could print the return value for testing, but your submission can just be a function. Then you won't need to parse input or print the output. For example int f(char *a){for(int i=0;i<strlen(a);i++){r+=((int)a[i]);for(int j=0;j<strlen(a);j++)r*=r;}return r==(int)a;}
Nov 8, 2016 at 19:03 comment added Aryaman @DrMcMoylex Using printf instead of making a new function uses less bytes, I believe. Thanks for the welcome, btw!
Nov 8, 2016 at 19:02 history edited Aryaman CC BY-SA 3.0
you can actually see the output!
Nov 8, 2016 at 18:53 history edited Aryaman CC BY-SA 3.0
deleted 43 characters in body
Nov 8, 2016 at 18:51 comment added DJMcMayhem You could write a small wrapper to print the return value of the function
Nov 8, 2016 at 18:48 comment added Aryaman @DrMcMoylex How would you know the output if I used return? There's nothing printed in the terminal...
Nov 8, 2016 at 18:05 review Late answers
Nov 8, 2016 at 18:28
Nov 8, 2016 at 17:56 comment added DJMcMayhem Welcome to the site! Some tips for you: 1) You have a lot of unnecessary whitespace. You could remove most of the newlines and spaces/indentation and it would still run fine. 2) A function is allowed, so you could return '1' or '0' instead of printing it. That would save a lot of bytes. 3) Since you're only doing one thing in each 'for' loop, you could join the inner code with the loop itself. For example: for(int i=0;i<strlen(a);r+=a[i++])
Nov 8, 2016 at 17:52 history edited Aryaman CC BY-SA 3.0
added 61 characters in body
Nov 8, 2016 at 17:50 review First posts
Nov 8, 2016 at 17:56
Nov 8, 2016 at 17:45 history answered Aryaman CC BY-SA 3.0