```{.javascript}
//javascript
function test(a){
return (a.toString().length-1)*(a/10);
}
//test
for (var j=0 ; j<10; j++){
var input = Math.pow(10, j);
console.log( "%d -> %d ", input, test( input )) ;
}
```
결과
1 -> 0
10 -> 1
100 -> 20
1000 -> 300
10000 -> 4000
100000 -> 50000
1000000 -> 600000
10000000 -> 7000000
100000000 -> 80000000
1000000000 -> 900000000
```{.javascript}
//javascript
function test(a){
return (a.toString().length-1)*(a/10);
}
//test
for (var j=0 ; j<10; j++){
var input = Math.pow(10, j);
console.log( "%d -> %d ", input, test( input )) ;
}
```
결과
1 -> 0
10 -> 1
100 -> 20
1000 -> 300
10000 -> 4000
100000 -> 50000
1000000 -> 600000
10000000 -> 7000000
100000000 -> 80000000
1000000000 -> 900000000