Question
C++ Ask user for two integers between 2 and 5000. Calculate if the factors of those numbers are perfect squares excluding 1. If the factors
C++
Ask user for two integers between 2 and 5000. Calculate if the factors of those numbers are perfect squares excluding 1. If the factors are perfect squares eg: 36 has 2*2 =4 , 3*3 =9, 6*6 = 36 , it should output 4,9,6 . if the number is square free such as 30 has no factors that are squares it should print none.
output needed
Enter the 1st integer of the pair, between 2 and 5000: 30
Enter the 2nd integer of the pair, between 2 and 5000: 36
30 has these factors (>1) that are square: (none)
30 is square-free
36 has these factors (>1) that are square: 4, 9, 36 36 is not square-free
Therefore, the ordered pair (30, 36) is SOUR.
Depending on the pair it should also list following at the end.
An ordered pair of positive integers can be classified in one of four ways:
If both of the integers in the pair are square-free, then this pair is SWEET.
If the first integer in the pair is square-free but the second one is not, then this pair is SOUR.
If the second integer in the pair is square-free but the first one is not, then this pair is SALTY.
If neither of the integers in the pair are square-fee, then this pair is BITTER.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started