paul7048's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
5 (0.01 per day)
Joined:
14-September 11
Profile Views:
174
Last Active:
User is offline Sep 16 2011 03:39 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   paul7048 has not set their status

Posts I've Made

  1. In Topic: Making a program that counts perfect, deficient, and abundant numbers?

    Posted 14 Sep 2011

    Thank you Adak, it runs through now.
  2. In Topic: Making a program that counts perfect, deficient, and abundant numbers?

    Posted 14 Sep 2011

    I've been reading a lot of topics and posts, and Dream.In.Code. seems like a great supporting environment. Nice to meet you Adak. Just being curious is your name from the middle east region?
  3. In Topic: Making a program that counts perfect, deficient, and abundant numbers?

    Posted 14 Sep 2011

    For my C++ class, I have to make a program that displays all numbers that are perfect, deficient, and abundant below 5,000. A number is called perfect if the sum of its divisors is equal to the original number, a number is called deficient if the sum of its divisors is less than the original number, and a number is called abundant if the sum of its divisors is more than the original number.

    I've made a "pre-program" that's going to I'm using to illustrate what the finished program will be doing, but I seem to be getting an error at the "else (counter<sum)" saying that there is no semicolon?

    I set the global constant to 15, and if the sum is equal to 6, then it will say that number is perfect, if the sum is greater than 6, it will say it's abundant, and if less than 6 then it's deficient.

    Here is the code I have so far:

    #include <iostream>
    using namespace std;
    //global constant
    const int maxvalue = 15;
    int sumofDivisor(int);
    int main()
    {
    int counter, sum;
    //for loop to max value
    sum=sumofDivisor(6);
    for(counter=1; counter<=maxvalue; counter++)
    
    if(counter==sum)
    
    {
    cout << " this number is perfect";
    }
    else if (counter>sum)
    {
    cout << "these are abundant";
    }
    else (counter<sum)
    {
    cout << "they're deficient";
    }
    
    return 0;
    }
    
    int sumofDivisor(int a)
    {
    
    return a;
    }
    

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

paul7048 hasn't added any friends yet.

Comments

paul7048 has no profile comments yet. Why not say hello?