Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- * @author winf103738
- */
- public class Zahl {
- static int zahl = 1000;
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- System.out.println(calcNumLength(zahl));
- }
- private static int calcNumLength(int num){
- int count = 0;
- while (num >= 10) {
- num = num / 10;
- count++;
- }
- if(num > 0){
- count++;
- }
- return count;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement