Pages

Saturday, 24 December 2016

Problem 59 - Binary to Decimal

     Binary to decimal convertion adalah program buat convert dari biner ke bilangan desimal
Code di bawah ini :

DATA HOSTED WITH ♥ BY PASTEBIN.COM - DOWNLOAD RAW - SEE ORIGINAL
  1. import java.util.Scanner;
  2. class BinaryToDecimal {
  3.     public static void main(String args[]){
  4.        Scanner input = new Scanner( System.in );
  5.        System.out.print("Angka biner: ");
  6.        String binaryString =input.nextLine();
  7.        System.out.println("Desimal : "+Integer.parseInt(binaryString,2));
  8.     }
  9. }

Disini saya coba biner : 101

0 comments:

Post a Comment