Home » Program to print all abundant numbers between 1 to 100

Program to print all abundant numbers between 1 to 100

by Online Tutorials Library

Program to print all abundant numbers between 1 and 100

The abundant number can be called an excessive number and defined as the number for which the sum of its proper divisors is greater than the number itself.

A first abundant number is the integer 12 having the sum (16) of its proper divisors (1,2,3,4,6) which is greater than itself(12).

Examples: 12, 18, 20, 24, 30, 36

In this program, we have to find all abundant numbers between 1 and 100.

Algorithm

  • STEP 1: START
  • STEP 2: DEFINE n, i, j
  • STEP 3: SET sum =0
  • STEP 4: SET n =100
  • STEP 5: REPEAT STEP 6 to STEP 10 UNTIL i<=n
  • STEP 6: REPEAT STEP 7 and STEP 8 UNTIL j<=i/2
  • STEP 7: if i%j ==0
  • STEP 8: sum =sum + j
  • STEP 9: if sum>i then PRINT i+
  • STEP 10: SET sum=0
  • STEP 11: END

Java Program

Output:

12 18 20 24 30 36 40 42 48 54 56 60 66 70 72 78 80 84 88 90 96 100   

C Program

Output:

12 18 20 24 30 36 40 42 48 54 56 60 66 70 72 78 80 84 88 90 96 100  

Python Program

Output:

12 18 20 24 30 36 40 42 48 54 56 60 66 70 72 78 80 84 88 90 96 100   

PHP Program

Output:

12 18 20 24 30 36 40 42 48 54 56 60 66 70 72 78 80 84 88 90 96 100  

C# program

Output:

12 18 20 24 30 36 40 42 48 54 56 60 66 70 72 78 80 84 88 90 96 100   
Next Topic#

You may also like