Saturday, April 9, 2016

Decimal To Octal Converter in Python

A simple program that I wrote using Python programming language that will ask the user to give decimal number and then our program will convert the given number into its octal equivalent.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing

def my_program():
   print()
   print("DECIMAL TO OCTAL CONVERTER")
   print()
   decimal = int(input("Enter a Number: "))
   print()
   print('The number {0} in Decimal is equivalent to '.format(decimal))
   print(oct(decimal), " in octal.");
   print("\n");
   repeat = input('Do you want to continue ? (Y/N) : ')

   if repeat.upper() == "N":
       print("\n")
       print("END OF PROGRAM")
       quit
   if repeat.upper() == "Y":
       my_program()

if __name__ == '__main__':
       my_program()



No comments:

Post a Comment