java - how do I count and print out the total number of zeros after the decimal places? -
i'm trying find way count , display total of numbers of string, don't know how go doing that. here's example:
65.0-43.0+21.0= 43.0 65 -43 +21 = 43 65.0 -43.0 +21.0 = 43.0 65 - 43 + 21 = 43 65.00 - 43.0 + 21.000 = +0043.0000 the output needs give me:
digit: 20 0 *that's total number of zeros have in example. not zeros after decimals. if can point me in right direction, appreciated. thanks!
here's pseudo-code want:
zerocount = 0 state = notafterpoint each character c if c == '.' state = afterpoint else if c not digit state = notafterpoint else if state == afterpoint , c == '0' zerocount++ print zerocount i'll leave converting java code you.
Comments
Post a Comment