Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Need help with logic part C++

Name: Anonymous 2007-03-03 20:11 ID:BL8afESO

I know I need to use a loop in this program but I have no idea what to use

problem
The proper divisors of an integer n are the positive integer divisors whose values are less than n. A positive integer is said to be a deficient, perfect, or abundant number if the sum of its proper divisors is, respectively, less than, equal to, or greater than the number. For example, 8 is deficient because its proper divisors are 1, 2, and 4, and 1 + 2 + 4 < 8; The integer 6 is perfect because its proper divisors are 1, 2, and 3, and 1 + 2 + 3 = 6; The integer 12 is abundant because its proper divisors are 1, 2, 3, 4, and 6, and
1 + 2 + 3 + 4 + 6 > 12. Write a program that classifies an integer n as being deficient, perfect, or abundant, for the following values of n:

               n = 20 to 30 inclusive
               n = 490 to 500 inclusive
               n = 8120 to 8130 inclusive

Display your results in a tabular format similar to the following example:

                Number                                     classification

                       8                                            deficient
                       6                                            perfect
                      12                                        abundant

Name: Anonymous 2007-03-03 20:13 ID:BL8afESO

this is what I did so far which is useless. is this suposed to be a loop in a loop problem ?

#include<iostream>


using namespace std;

int main()
{
    int num=0;
    int cat;
   
    cout<<"Number                            Classification \n";
    cout<<"______________________________________________________\n";
   
    while (num++ < 30)
    {cout<<num<<"num \n";
    while
    num++;
    }
                            
    cout<<"\n";
    system("pause");
    return 0;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List