• MineBBS 第一期星光推广计划开始了!丰富的金粒奖励,还有现金大奖噢~【点我去看看】
1056完数

Source Code 1056完数 2023-08-27

Source of resources
Original
Copyright link
#
Language
Chinese(Simplified)
Precondition
vsc
我自己写的,肯定有不足的地方,还请各位大佬们指教
C++:
#include<iostream>
using namespace std;
int main()
{
    int n,i,j,a=0,b;
    cin >> n;
    for (i=2; i < n; i++)
    {
        for (int j = 1; j < i; j++)
        
            if (i % j == 0)
            a = a + j;

            if (a == i)
            {
                cout << i << " its factors are ";
                for (b = 1; b < i; b++)
                {
                    if (i % b == 0)
                        cout << b << " ";
                }
                cout << "\n";
            }
        a = 0;
    }
    return 0;
}
Author
Binary
Price
1金粒
Downloads
1
Views
286
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Binary

Share this resource