3.程序流程图
4.代码实现
#include<bits/stdc++.h> using namespace std; main() { int i,j,s,n; printf("请输入所选范围上限:"); scanf("%d", &n); for(i=2;i<=1000;i++) { s=0; for(j=1;j<=n/2;j++) { if(i%j==0) s+=j; } if(s==i) printf("It's a perfect number:%d.\n", i); } }
5.测试截图
标签:std,int,namespace,5.26,打卡,main From: https://www.cnblogs.com/binglinll/p/17434546.html