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.
1 parent 360bf39 commit 8d70990Copy full SHA for 8d70990
Random Python Programs/decimal_to_octal.py
@@ -0,0 +1,29 @@
1
+"""
2
+Decimal To octal
3
+
4
5
6
7
+def decimal_to_binary(n):
8
9
+ temp = 1
10
+ main = 0
11
+ while (temp <= n):
12
+ temp *= 8
13
14
+ temp //= 8
15
16
+ while (temp > 0):
17
18
+ lastdigit = n // temp
19
+ n -= lastdigit * temp
20
21
+ main = main * 10 + lastdigit
22
23
+ return main
24
25
26
+if __name__ == "__main__":
27
28
+ n = int(input("Entre number"))
29
+ print(decimal_to_binary(n))
0 commit comments