Java
xxxxxxxxxx
class Main {
public static void main(String[] args) {
â
long num = 110110111;
â
int decimal = convertBinaryToDecimal(num);
â
System.out.println("Binary to Decimal");
System.out.println(num + " = " + decimal);
}
â
public static int convertBinaryToDecimal(long num) {
int decimalNumber = 0, i = 0;
long remainder;
while (num != 0) {
remainder = num % 10;
num /= 10;
decimalNumber += remainder * Math.pow(2, i);
++i;
}
return decimalNumber;
}
}
110110111 in binary = 439 in decimal
Linux - Comment installer anc-api-tools
Linux - Comment installer curvedns
Linux - Comment installer zenmap
Python - Vérifier si un nombre est positif, négatif ou 0
C - Compter le nombre de chiffres dans un entier
C++ - VĂ©rifier si un nombre est premier ou non
C - Trouver le plus grand nombre à l'aide de l'allocation de mémoire dynamique
C++ - Vérifier l'année bissextile
JavaScript - VĂ©rifier si une chaĂźne commence et se termine par certains caractĂšres
Kotlin - Inverser un nombre
Linux - Comment installer zstd
C++ - Trouver le quotient et le reste
Python - Ăcriture de fichiers Excel (XLSX)
Linux - Comment installer xbitmaps
Kotlin - Trouver la factorielle d'un nombre
Kotlin - Arrondir un nombre à n décimales
Java - Inverser un nombre
Java - Créer une pyramide et un motif
We have been online since 2021 and 1 millions of people around the globe have visited our website since then
More visitors every month