Computer Science, asked by dukeignite, 4 months ago

Q2. Write a java program to accept a positive integer and count number of digits in it.

Answers

Answered by laibaKounain
2

public class Main {

public static void main(String[] args) {

int count = 0, num = 0003452;

while (num != 0) {

// num = num/10

num /= 10;

++count;

}

System.out.println("Number of digits: " + count);

}

}

I hope it helps u

make me a brilliant

Similar questions