Count digit in a given number 👐👐👐!!!!!!!!!!!!!!!!!
Example -
if given number -->
X = 7654;
result -> 4
X = 765;
result -> 3
X = 76;
result -> 2
public class CountDigit {
public static void main(String[] args) {
//count digits in a given number
int x = 9876;
int result =0;
while(x>0)
{
x = x/10;
result ++;
}
System.out.println("Total digit -> "+result);
//in this case result will be 4 } }
Time complexity: θ(d)
where d is the number of the digit in the input number.
Find another must-read post.
4E56B20E97
ReplyDeleteTakipçi Satın Al
Whiteout Survival Hediye Kodu
MMORPG Oyunlar
Kafa Topu Elmas Kodu
Roblox Şarkı Kodları
440DAF2B56
ReplyDeleteTakipçi Satın Al
Cami Avizesi
İçki Fiyatları
575CF0B8
ReplyDeleteErzurum
Trabzon
Şırnak
Kırşehir
Kırklareli
Erzincan
Tunceli
Kayseri
Adıyaman