请教一个小问题!
S=20+21+22+23+......+2n,直到S<=100.
帮我看一下,我那里编错了,谢谢!
#include <math.h>
#include <stdio.h>
int main(void)
{
int x = 2, y = 0,s=0;
return 0;
while(s<=100)
{
s=s+pow(x,y);
++y;
}
printf("%d", s);
}
S=20+21+22+23+......+2n,直到S<=100.
帮我看一下,我那里编错了,谢谢!
#include <math.h>
#include <stdio.h>
int main(void)
{
int x = 2, y = 0,s=0;
return 0;
while(s<=100)
{
s=s+pow(x,y);
++y;
}
printf("%d", s);
}
[此贴子已经被作者于2007-9-14 12:26:16编辑过]