A perfect number is a number that is the sum of all of its divisors greater than one. That is, it is the sum of all the numbers less than itself which divide into it without a remainder. 6 is a perfect number because its divisors are 1, 2,  and 3 and the sum of those divisors is 6.Write pseudocode to display the first three perfect numbers.

What will be an ideal response?

num perfects = 0
num current = 2
num sum = 0

while perfects < 3
  sum = 0
  for num x = 1 to current - 1
    if current mod x = 0
      sum = sum + current
 endfor
  if sum = current
    print current
    perfects = perfects + 1
  endif
  current = current + 1
endwhile

Computer Science & Information Technology

You might also like to view...

When a new workbook is created from a template, any changes made to the workbook will overwrite any formatting in the template

Indicate whether the statement is true or false.

Computer Science & Information Technology

The accompanying figure shows a cell in Microsoft Excel 2016 with _____.?

A. mixed references? B. ?financial functions C. ?center aligned text D. ?the fill color option

Computer Science & Information Technology