Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Whats wrong with my code? why time out error appear? The proper factors'* of Integer n are all the factors of n that are less
Whats wrong with my code? why time out error appear?
The "proper factors'* of Integer n are all the factors of n that are less than n. So, the factors of 10 are 1, 2 5, and 10, but the proper factors of 10 are just 1, 2, and 5. A number n is "abundant" if Its proper factors add up to more than n. n Is "deficient" if its proper factors add up to less than n. n is "perfect" if its proper factors add up to exactly n. Given a positive integer, return whether the number is abundant, deficient, or perfect. numberType(4) rightarrow "deficient" numberType(6) rightarrow "perfect" numberType(12) rightarrow "abundant" String numberType(int num) {int i-1; int sum-0; String ans=""; while (iStep 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