Here's the code is used but...but still something is wrong... i need help...
Code:
/*CONVERTING DECIMAL TO OCTAL*/
String inputDeci,octal="";
int deci,count=0, i, h;
inputDeci = JOptionPane.showInputDialog("Enter a decimal number ");
deci = Integer.parseInt(inputDeci);
int [] quotient = new int [50];
int [] remainder = new int [50] ;
quotient[0] = deci / 8;
remainder[0] = deci % 8;
octal+=""+remainder[0];
for (i = 0; remainder[0+i] < 8 || quotient[0+i]>= 8; i++){
quotient[i+1] = quotient[i] / 8;
remainder[i+1] = quotient[i] % 8;
count+=1;
System.out.println(remainder[i]);
}
for(h=count;h<0;h--){
octal+= ""+ remainder[h];
}
Comment