Vấn đề: Viết một chương trình bằng Python để chuyển đổi số thập phân thành biểu diễn bát phân tương ứng của nó. Write a Program in Python to convert a decimal number into its corresponding octal representation. Example:Input: 8
Output: 10
Input: 15
Output: 17
Chuyển đổi thập phân sang bát phân trong Python bằng cách sử dụng vòng lặp
Cách tiêu chuẩn để chuyển đổi số thập phân thành một bát phân là chia số thập phân cho 8 cho đến khi giảm xuống còn 0.
Sau khi phân chia kết thúc, nếu chúng ta xếp các phần còn lại theo cách từ dưới lên, giá trị kết quả sẽ là số octal tương đương.
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
Output::
Nhập số thập phân: 15 nhị phân 15 là: 17
Binary of 15 is: 17
Chuyển đổi thập phân sang bát phân trong Python bằng cách sử dụng đệ quy
Để chuyển đổi thập phân thành bát phân bằng cách sử dụng đệ quy, chúng tôi chuyển chỉ số [cổ tức/8] sang cuộc gọi đệ quy tiếp theo và đầu ra giá trị còn lại [cổ tức%8].
Chúng tôi lặp lại quá trình cho đến khi số giảm xuống 0 [nghĩa là cho đến số thập phân> 0].
Kể từ khi đệ quy thực hiện ngăn xếp, phần còn lại được in theo cách từ dưới lên và chúng tôi nhận được số octal tương đương.
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
Output::
Nhập số thập phân: 8 Octal: 10
Octal: 10
Chuyển đổi thập phân sang bát phân bằng OCT []
Phương pháp Python tích hợp oct[]
trả về biểu diễn bát phân của số thập phân được truyền dưới dạng tham số.
Nó trả về một số bát phân dưới dạng 0oxyz
, trong đó xyz
là giá trị số bát giác thực tế.
>>> print[oct[15]]
0o17
Nhận xét bên dưới nghi ngờ hoặc đề xuất của bạn nếu bạn có bất kỳ.
Đưa ra một số thập phân làm đầu vào, chúng ta cần viết một chương trình để chuyển đổi số thập phân đã cho thành một số bát phân tương đương. tức là chuyển đổi số với giá trị cơ sở 10 thành giá trị cơ sở 8. Giá trị cơ sở của hệ thống số xác định số chữ số được sử dụng để biểu diễn giá trị số. Ví dụ: hệ thống số nhị phân sử dụng hai chữ số 0 và 1, hệ thống số octal sử dụng 8 chữ số từ 0-7 và hệ thống số thập phân sử dụng 10 chữ số 0-9 để biểu thị bất kỳ giá trị số nào.
Ví dụ: & nbsp;
Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 41
Algorithm: :
- Lưu trữ phần còn lại khi số được chia cho 8 trong một mảng.
- Chia số cho 8 bây giờ
- Lặp lại hai bước trên cho đến khi số không bằng 0.
- In mảng theo thứ tự ngược lại ngay bây giờ.
Ví dụ: & nbsp;
Nếu số thập phân đã cho là 16. & nbsp;
Bước 1: Phần còn lại khi 16 được chia cho 8 là 0. Do đó, ARR [0] = 0. & NBSP; được chia cho 8, là 2. Do đó, ARR [1] = 2. & nbsp; Bước 4: chia 2 cho 8. Số mới là 2/8 = 0. & nbsp; Bước 5: Vì số trở thành = 0. & nbsp;: Remainder when 16 is divided by 8 is 0. Therefore, arr[0] = 0.
Step 2: Divide 16
by 8. New number is 16/8 = 2.
Step 3: Remainder, when 2 is divided by 8, is 2. Therefore, arr[1] = 2.
Step 4: Divide 2 by 8. New number is 2/8 = 0.
Step 5: Since number becomes = 0.
Dừng các bước lặp lại và in mảng theo thứ tự ngược lại. Do đó, số octal tương đương là 20.
Sơ đồ dưới đây cho thấy một ví dụ về việc chuyển đổi số thập phân 33 thành số octal tương đương. & NBSP; & nbsp;
Dưới đây là việc thực hiện ý tưởng trên. & Nbsp; & nbsp;
C
#include
void
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
2decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
6decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
9decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
1 def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
2def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
4def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
6def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
8decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
2 >>> print[oct[15]]
0o17
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 >>> print[oct[15]]
0o17
5def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3>>> print[oct[15]]
0o17
7>>> print[oct[15]]
0o17
3>>> print[oct[15]]
0o17
9Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 410
>>> print[oct[15]]
0o17
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 413
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 417
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 419
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4oct[]
1 oct[]
2>>> print[oct[15]]
0o17
0C++
oct[]
4
oct[]
5 oct[]
6 oct[]
7
void
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
2decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
6decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
9decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
1 def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
2decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
2 >>> print[oct[15]]
0o17
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 >>> print[oct[15]]
0o17
5def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
6def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
8decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
2 >>> print[oct[15]]
0o17
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 >>> print[oct[15]]
0o17
5def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3#include
6>>> print[oct[15]]
0o17
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 413
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 417
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 419
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4oct[]
1 oct[]
2>>> print[oct[15]]
0o17
0oct[]
5 oct[]
6 oct[]
7
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
4Java
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
00 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
01decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
02 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
03decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
05 void
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
2def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1____114decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
15 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1____117decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
18decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
19decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
30decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
31decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
32decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
24decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
30decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
35decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
32decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
24decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
30def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
8def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3>>> print[oct[15]]
0o17
0def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
222__123decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
24decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
30decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
52decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
1 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
27decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
23decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
29decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3>>> print[oct[15]]
0o17
2 >>> print[oct[15]]
0o17
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
46decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
47decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
48decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
23decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
50def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 419
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0>>> print[oct[15]]
0o17
0Python3
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
56 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
05 void
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
59def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
64decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
65decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
24decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
72 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
73decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
75decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
17decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
23decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
79decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
80 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
18def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
93decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
95decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
96 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
32def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
95decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1______202def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
83def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
08decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
47decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
2 def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
13def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
14 def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
15def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
16__def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
27def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
28decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
30decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
95decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
65def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
34C#
oct[]
5
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
36decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
02 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
03decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
05 void
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
2decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1____114decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
15 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
52def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
9def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
1 def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
2
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
30def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
30def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
6decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
30def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
8def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3>>> print[oct[15]]
0o17
0def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3>>> print[oct[15]]
0o17
2 >>> print[oct[15]]
0o17
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 >>> print[oct[15]]
0o17
5decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
30def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
73decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
56 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
05 void
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
80decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 417
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 419
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0>>> print[oct[15]]
0o17
0PHP
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
91def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
92 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
0def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
94def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
05decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
98decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
24decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
01 >>> print[oct[15]]
0o17
02decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
1 >>> print[oct[15]]
0o17
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
94 >>> print[oct[15]]
0o17
07decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
98decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
17>>> print[oct[15]]
0o17
01>>> print[oct[15]]
0o17
14def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
94 >>> print[oct[15]]
0o17
16def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
94 >>> print[oct[15]]
0o17
19def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
94 >>> print[oct[15]]
0o17
21def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3>>> print[oct[15]]
0o17
01>>> print[oct[15]]
0o17
24decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
2 >>> print[oct[15]]
0o17
29>>> print[oct[15]]
0o17
30 >>> print[oct[15]]
0o17
31>>> print[oct[15]]
0o17
01def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3>>> print[oct[15]]
0o17
39 def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
98decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
17>>> print[oct[15]]
0o17
30decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
19>>> print[oct[15]]
0o17
0def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
94 >>> print[oct[15]]
0o17
46decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
0def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
94>>> print[oct[15]]
0o17
49
>>> print[oct[15]]
0o17
50JavaScript
>>> print[oct[15]]
0o17
51def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
92 def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
34decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
56decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
15 >>> print[oct[15]]
0o17
58decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
60decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
1 def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
2def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
4def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3>>> print[oct[15]]
0o17
67def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
8decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
2 >>> print[oct[15]]
0o17
74def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3>>> print[oct[15]]
0o17
76>>> print[oct[15]]
0o17
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
79decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 419
>>> print[oct[15]]
0o17
82Độ phức tạp về thời gian: O [log n] & nbsp; O[log N]
Độ phức tạp không gian: O [n] Kể từ khi tạo mảng để lưu trữ các số bát phân since creating array to store octal numbers
Một cách tiếp cận khác: [O [1] Độ phức tạp không gian]
Vấn đề này cũng có thể được giải quyết mà không cần sử dụng mảng & nbsp; sử dụng thuật toán sau:
- Khởi tạo num octal thành 0 và CountVal đến 1 và số thập phân là n
- Tìm phần còn lại khi số thập phân chia cho 8
- Cập nhật số Octal của Octalnum + [phần còn lại * CountVal]
- Tăng CountVal của CountVal*10
- Chia số thập phân cho 8
- Lặp lại từ bước thứ hai cho đến khi số thập phân bằng không
Dưới đây là việc thực hiện ý tưởng trên:
C++
oct[]
4
oct[]
5 oct[]
6 oct[]
7
void
>>> print[oct[15]]
0o17
88decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 >>> print[oct[15]]
0o17
90decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 >>> print[oct[15]]
0o17
94decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 >>> print[oct[15]]
0o17
97decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4100
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4103
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4105
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4107
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4109
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4113
>>> print[oct[15]]
0o17
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 413
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 417
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4122
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4oct[]
1 oct[]
2>>> print[oct[15]]
0o17
0C
#include
void
>>> print[oct[15]]
0o17
88decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 >>> print[oct[15]]
0o17
90decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 >>> print[oct[15]]
0o17
94decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 >>> print[oct[15]]
0o17
97decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4100
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4103
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4105
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4107
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4109
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
7>>> print[oct[15]]
0o17
3>>> print[oct[15]]
0o17
9Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4157
>>> print[oct[15]]
0o17
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 413
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 417
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4122
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4oct[]
1 oct[]
2>>> print[oct[15]]
0o17
0C
Java
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
02 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
03decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
00 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
01decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
05 void
Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4178
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 >>> print[oct[15]]
0o17
90def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4185
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
23Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4187
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
47decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
24def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 >>> print[oct[15]]
0o17
97def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4195
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
23decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
29decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
30Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4105
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
30oct[]
06oct[]
07decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
24decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
30oct[]
10decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
32decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
24def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3>>> print[oct[15]]
0o17
0def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3oct[]
16decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
30decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 oct[]
00decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
32decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
24decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
56 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
05 void
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
59def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3oct[]
32decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0>>> print[oct[15]]
0o17
0Python3
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
64decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
65decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
24decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
72 oct[]
37decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
75decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
23decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4oct[]
43decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
47decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4oct[]
47decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76 oct[]
49decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
1 oct[]
52decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
23decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
91def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
75def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
08decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76 oct[]
57decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
80 oct[]
68def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3oct[]
43decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76 oct[]
43decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
80 oct[]
07def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3oct[]
59def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
03def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
03decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
32decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
27oct[]
83oct[]
84 oct[]
85
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76 oct[]
88oct[]
89decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
95decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
65decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4oct[]
95C#
oct[]
5
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
36decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
02 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
03decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
05 void
Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4178
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 >>> print[oct[15]]
0o17
90decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 >>> print[oct[15]]
0o17
94def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4100
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
30decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4103
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
30Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4105
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
30Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4107
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
30Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4109
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3>>> print[oct[15]]
0o17
0def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
30oxyz
26decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
56 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
05 void
0oxyz
330oxyz
340oxyz
35decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 417
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3oct[]
32decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0>>> print[oct[15]]
0o17
0JavaScript
>>> print[oct[15]]
0o17
51def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
92 0oxyz
48decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
40oxyz
51decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
40oxyz
53decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4100
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
30oxyz
58def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4105
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4107
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
30oxyz
64decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
40oxyz
680oxyz
69>>> print[oct[15]]
0o17
49>>> print[oct[15]]
0o17
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
79decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4122
>>> print[oct[15]]
0o17
82Độ phức tạp về thời gian: O [log n]O[log N]
Không gian phụ trợ: O [1] O[1]
Sử dụng hàm được xác định trước
Java
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
00 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
01decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
02 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
03decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
05 void
Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4178
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 >>> print[oct[15]]
0o17
90decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
30oxyz
91decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 >>> print[oct[15]]
0o17
94decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4100
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3xyz
07decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0>>> print[oct[15]]
0o17
0Python3
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
30decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4103
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
27>>> print[oct[15]]
0o17
3xyz
16xyz
17oct[]
84 oct[]
85
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76 oct[]
88oct[]
89decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
95decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
76 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
65decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4xyz
07C#
oct[]
5
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
36decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
02 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
03decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
05 void
Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4178
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 >>> print[oct[15]]
0o17
90decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3xyz
47decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 >>> print[oct[15]]
0o17
94decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 417
def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
3xyz
61decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4>>> print[oct[15]]
0o17
0>>> print[oct[15]]
0o17
0JavaScript
>>> print[oct[15]]
0o17
51def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
92 0oxyz
48decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4xyz
70>>> print[oct[15]]
0o17
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4def dectoOct[decimal]:
if[decimal > 0]:
dectoOct[[int][decimal/8]]
print[decimal%8, end='']
decimal = int[input["Enter a decimal number: "]]
print["Octal: ", end='']
dectoOct[decimal]
1 Input : 16 Output: 20 Input : 10 Output: 12 Input : 33 Output: 4100
xyz
07
>>> print[oct[15]]
0o17
82C++
xyz
76
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
40oxyz
680oxyz
69>>> print[oct[15]]
0o17
49Độ phức tạp về thời gian: O [log n]
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4xyz
85decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4xyz
87Không gian phụ trợ: O [1]
>>> print[oct[15]]
0o17
0Sử dụng hàm được xác định trước
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
3Java
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4xyz
99decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
00 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
01>>> print[oct[15]]
0o17
0decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
56 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
05 void
0oxyz
85decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
1 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
2decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
4decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
56 decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
05 void
decimal = int[input["Enter a decimal number: "]]
octal = 0
ctr = 0
temp = decimal #copying number
#computing octal using while loop
while[temp > 0]:
octal += [[temp%8]*[10**ctr]] #Stacking remainders
temp = int[temp/8] #updating dividend
ctr += 1
print["Binary of {x} is: {y}".format[x=decimal,y=octal]]
59