You are here:   HomeJava ProgrammingJava ArrayDeleting Desire Element of Linked List Java Example
by Dinesh Thakur Category: array

Algorithm for Convert decimal integer to octal Number:

step 1: set r=0, i=0

step 2: create two integer arrays a[],b[] of size 10

step 3: read num

step 4: repeat through step-11 while num greater than 0

step 5: if num less than 8 then execute following codes otherwise goto

step- 9

step 6: a[i]=num

step 7: i=i+ 1

step 8: goto step-4

step 9: a[i]=num%8

step 10: i=i+ 1

step 11: num= num/ 8

step 12: initialize q=i-1

step 13: repeat through step-16 while q greater than or equals to 0

step 14: b[r]=a[q]

step 15: r=r+ 1

step 16: q=q-1

step 17: initialize q=0

step 18: repeat through step-20 while q less than r

step 19: print b[q]

step 20: q=q+ 1

step 21: Exit

Here is the Java Example for Convert Decimal integer to Octal Number:

import java.util.Scanner;
public class ConvertDectoOctal
                   public static void main(String args[])
                       int r=0,q,o=0,num;
                       int a[]=new int[10];
                       int b[]=new int[10];
                       Scanner sl=new Scanner(;
                       System.out.print("Enter a number : ");
                       System.out.println("\nEntered Number is :->"+num);
                                    b[r]=a[q] ;
                                    System.out.print("Octal number is :->"); 

Convert decimal integer to octal number

Subscribe To Free Daily Newsletter!

Get Free News Updates Delivered Directly To Your Inbox
About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to contact us.

What's New and Popular

Popular Article