""" Python program to convert a decimal number to octal number without using direct functions for standard base conversions like oct()""" def dec_to_octal(n): # function to convert decimal to octal octal_num = [0] * 100; # create array to store octal number i = 0; # counter for octal while (n != 0): octal_num[i] = n % 8; # storing remainder n = int(n / 8); i += 1; for j in range(i - 1, -1, -1): print(octal_num[j], end = ""); #_____main_____ num=int(input("Please enter a number: ")) dec_to_octal(num)Output 1:Please enter a number:123173Output 2:Please enter a number:2430

इन्हें भी देखें।

- while loop
- for loop
- nested loops
- loop control statements (Break, Continue, Pass)
- if statement
- if-else statement
- if-elif statement
- nested if statement
- range() function
- keywords
- Identifiers (names)
- Literals
- Operators
- punctuatorts

Python Programs के लिये यहाँ click करें।