samedi 16 octobre 2021

Find the smallest power to get the desired integer

A "finger exercise" from the text: Write a program that asks the user to enter an integer and prints two integers, root and power, such that 1 < power < 6 and root ** power is equal to the integer entered by the user. If no such pair of integers exists, it should print a message to that effect. Write the program so that if the user gives integer 64, then your program will answer that 8 ** 2 is 64, that is, it looks for the lowest power for which root ** power is the desired integer.

Aucun commentaire:

Enregistrer un commentaire