A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Spring in Action
this week in the
Better way than this one?
Joined: Oct 27, 2005
Oct 28, 2005 05:13:00
Someone insert a numer like e.g 123
the output is 3 (number of digits)
Is there any easy way to do that instead of this :
System.out.print ( "insert number: ");
int number = Integer.parseInt(br.readLine().trim());
int count = 0;
int digit= number%10;
if(number >= 0) count++;
I know there's a better way to do this , like with a for- loop or something.
I'm getting a "blank" , can't remember
Thanks a lot.
Joined: Aug 05, 2005
Oct 28, 2005 05:21:00
I agree. Here's the link:
subject: Better way than this one?
a simple counter 1 to 100
Extracting numbers from from a user input and comparing it to
how to get this output
cant get counters to work correctly
Update an array
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014