//OPTION #1 int d = 1; int temp = n * 1000; while (temp > 9) { temp = temp / 10; d++; }