Base converting program in Java


public class Base
{
public void decTobase(int n,int b)
{
if(n>0)
{
decTobase(n/b,b);
System.out.print(n%b);
}
}
public static void main(String args [])
{
Base a=new Base();
a.decTobase(15,2);
System.out.println();
a.decTobase(65,4);
System.out.println();
a.decTobase(511,8);
System.out.println();
}

Comments

Popular posts from this blog

GL_QUAD_STRIP Example In OpenGl

GL_POLYGON Example In OpenGl