Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function that will read one integer from the command prompt. Your second function will decide whether the entered number is Perfect Number and

image text in transcribed
Write a function that will read one integer from the command prompt. Your second function will decide whether the entered number is Perfect Number and Harmonic Divisor Number. The input must be a natural number. Perfect Number is the number at which the sum of all natural number divisor of a natural number n is equal to itself. ( 1 included, not including itself). Harmonic Divisor Number or Ore Number is a positive integer whose divisors have a harmonic mean that is an integer. Let the function continue working until it gets the input then end the program. Function prototype is void decide_perfect_harmonic_number() Example: Please enter input number : 6 Natural Number Divisors: 1,2,3,6 Is Perfect Number? : Yes Hint: 1+2+3=6 and input 6 . That's why it's the perfect number. Is Harmonic Divisor Number? : Yes Hint: Number 6 has the four divisors. Their harmonic mean is an integer: 4/((1/1)+(1/2)+(1/3)+(1/6))=2 Please enter input number : 28 Natural Number Divisors: 1,2,4,7,14,28 Is Perfect Number? : Yes Hint: 1+2+4+7+14=28 and input 28 . That's why it's the perfect number. Is Harmonic Divisor Number? : Yes Hint: Number 28 has the six divisors. Their harmonic mean is an integer: 6/((1/1)+(1/2)+(1/4)+(1/7)+(1/14)+(1/28)=2 Please enter input number : 15 Natural Number Divisors: 1,3,5,15 Hint: 1+3+5=9 but input 15 . That's why it's not the perfect number. is Perfect Number? : No Is Harmonic Divisor Number? : No Hint: Number 15 has the four divisors. Their harmonic mean is not an integer: 4/((1/1)+(1/3)+(1/5)+(1/15))=1.6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Demonstrate three aspects of assessing group performance?

Answered: 1 week ago