c学的不是很好,看不出错哪了,请帮忙看看
//题目:一个数如果恰好等于它的因子之和,这个数就称为“完数”。例如6=1+2+3.编程找出1000以内的所有完数。#include<stdio.h>
void main()
{
long int s,t=1,i=0;
long int b[1000],a;
if(s=1;s<=1000;s++)
{
if(a=2;a<=s;a++)
{
if(s%a==0)
{
t=t+a;
s=s/a;
}
}
if(s==t)
{
b[i]=s;
i++;
}
}
printf("the wanshu is:\n");
for(long int j=0;j<=i;j++)
printf("%ld ",b[j]);
}
Compiling...
19.cpp
E:\xyq\19.cpp(9) : error C2143: syntax error : missing ')' before ';'
E:\xyq\19.cpp(9) : warning C4390: ';' : empty controlled statement found; is this the intent?
E:\xyq\19.cpp(9) : warning C4552: '<=' : operator has no effect; expected operator with side-effect
E:\xyq\19.cpp(9) : error C2059: syntax error : ')'
E:\xyq\19.cpp(10) : error C2143: syntax error : missing ';' before '{'
E:\xyq\19.cpp(11) : error C2143: syntax error : missing ')' before ';'
E:\xyq\19.cpp(11) : warning C4390: ';' : empty controlled statement found; is this the intent?
E:\xyq\19.cpp(11) : warning C4552: '<=' : operator has no effect; expected operator with side-effect
E:\xyq\19.cpp(11) : error C2059: syntax error : ')'
E:\xyq\19.cpp(12) : error C2143: syntax error : missing ';' before '{'
Error executing cl.exe.
19.obj - 6 error(s), 4 warning(s)