A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
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:
- it saves me about five hours per week
subject: Better way than this one?
Extracting numbers from from a user input and comparing it to
Update an array
a simple counter 1 to 100
cant get counters to work correctly
how to get this output
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013