# Calculate number of characters in code [closed]

The task is to find the number of characters in your source code up to the previous line.

You may do some addition of two integers, or whatever that comes to mind. But at the end of your logic, you need to calculate the number of characters written in your code up to the last line.

EDIT: The goal is to find the number of characters required to perform a task. For example, you are adding two numbers. The task is to find the number of characters used in doing that task.

New line characters do not count. Lets start.

• Can one hardcode the output? What's to stop someone from doing 1\n1\nprint(1+1)? – xnor Jun 26 '14 at 13:31
• The previous line to which line of code? Previous to the end? Previous to the start? – Grax32 Jun 26 '14 at 13:33
• As it is, this question is too broad. Arbitrary code C + arbitrary arithmetic expression E such that the the result of E is the length of C can pretty much be anything. – Dennis Jun 26 '14 at 13:47
• See my edit. Hopefully, it is more clear now and not so broad. – Shafi Jun 26 '14 at 14:03

function foo() {