Convert to Decimal from different Base(octal,hexadecimal,binaryetc)
Posted by Unknown on Thursday, August 13, 2015 with No comments
import java.io.*;
import java.util.*;
public class Maintest {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = br.readLine();
while(s!=null)
{
Integer dec = Integer.parseInt(s,2);
/* red colored number is the base.Change this as you want*/
System.out.println(dec);
s = br.readLine();
}
}
}
import java.util.*;
public class Maintest {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = br.readLine();
while(s!=null)
{
Integer dec = Integer.parseInt(s,2);
/* red colored number is the base.Change this as you want*/
System.out.println(dec);
s = br.readLine();
}
}
}
Coded by sudipto
0 comments:
Post a Comment