fork download
  1. def calculate_coordinates(decimal):
  2. remainder = decimal % 9
  3. x = remainder % 3
  4. y = (remainder // 3) % 3
  5. return x, y
  6.  
  7. def main():
  8. decimal = int(input("Enter decimal (1-9): "))
  9. if 1 <= decimal <= 9:
  10. x, y = calculate_coordinates(decimal)
  11. print(f"Decimal: {decimal}")
  12. print(f"Coordinates: ({x}, {y})")
  13. else:
  14. print("Invalid input. Please enter a decimal between 1 and 9.")
  15.  
  16. if __name__ == "__main__":
  17. main()
Success #stdin #stdout 0.03s 9752KB
stdin
9
stdout
Enter decimal (1-9): Decimal: 9
Coordinates: (0, 0)