Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Lv 1148 points

Jessica

Favorite Answers33%
Answers3
  • Does someone know how to make a program that displays if a number is a perfect number?

    Hi, I need to create a program that will display if a number is a perfect number or not. We need to use a boolean to determine if its perfect or not. Heere is what I have, but it's not working correctly.It displays that all numbers are perfect.Can someone help me find the problem?

    #include <iostream>

    #include <cmath>

    using namespace std;

    int main ()

    {

    //Prompt user to enter number and declare variables.

    int n, sum = 0, f;

    cout << "Please enter a number." << endl;

    cin >> n;

    while (n < 0)

    {

    cout << "Please enter a number." << endl;

    cin >> n;

    }

    //Declare a boolean variable and additional variables as needed.Use rule to determine if it's a perfect number.

    bool result;

    for( f = 1; f <= n/2; f++)

    if ( n % f == 0)

    sum += f;

    if ( sum == n)

    result = true;

    else

    result = false;

    //Use boolean variable to display results.

    if (result = true)

    cout << "The number " << n << " is a perfect number." << endl;

    else if (result = false)

    cout << "The number " << n << " is not a perfect number." << endl;

    //Return that all is ok.

    return 0;

    }

    1 AnswerProgramming & Design10 years ago
  • How do I know what the applicable sales tax is?

    I'm getting a subscription for teenvogue, it's $10, however it says to add applicable sales tax. How do I know how much the sales tax is?

    2 AnswersUnited States10 years ago