We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3816088 + 850b311 commit e0c07f4Copy full SHA for e0c07f4
.DS_Store
0 Bytes
Decimal to octal.java
@@ -0,0 +1,19 @@
1
+#import java.util.*;
2
+class Decimal_Octal
3
+{
4
+ public static void main()
5
+ {
6
+ Scanner sc=new Scanner(System.in);
7
+ int n,k,d,s=0,c=0;
8
+ n=sc.nextInt();
9
+ k=n;
10
+ while(k!=0)
11
12
+ d=k%8;
13
+ s+=d*(int)Math.pow(10,c++);
14
+ k/=8;
15
+ }
16
+ System.out.println("Decimal number:"+n);
17
+ System.out.println("Octal equivalent:"+s);
18
19
+}
0 commit comments