Question: Problem A Python Integer Properties Languages en is Write a program that does the following: First, repeatedly checks whether an integer has positive divisors or

Problem A Python
Integer Properties
Languages
en
is
Write a program that does the following:
First, repeatedly checks whether an integer has
positive divisors or more. A number
is said to be a divisor of
if there is no remainder after dividing
by
. The repetition should stop as soon as q or Q is entered.
Second, reads the integer
from the keyboard. Finds and prints:
all positive two digit integers up to and including
whose digit sum squared is equal to the integer in question;
and all positive three digit integers up to and including
whose digit sum cubed is equal to the integer in question.
The digit sum of an integer
is found by taking each digit of
and adding them all together.
Input
First, the input for part one will be provided: Zero or more integers will appear in the input, each on its own line, followed by a line containing only a q or a Q, which indicates the repetition should stop.
Then, the input for part two follows: One line containing the integer
.
You may assume that each integer in the input will be between
and
.
Output
For each integer input in the first part, the program outputs yes if the integer has
or more positive divisors, otherwise it outputs no.
Then the program outputs the integers found in part two in ascending order, each on its own line.
The program must handle input and output in the correct order. In other words, it cannot read the next integer before producing the output for the previous one.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!