public class Su
{
public static void main(String[] args)
{
int sum = 0;
int jia= 0;
int jian = 0;
for(int i =1; i<=100; i++)
{
if(i % 2 != 0)
{
jia = i+1;
}
else
{
jian = i- 1;
}
}
sum = jia + jian;
System.out.println(sum);
}
}
boolean e=true;
int a=1;
double s;
while(e){
if(a==100)
break;
if(a%2==1){
s=s+1/(-a);
}else{
s=s+1/a;
}
a=a+1;
}
这样不知错不错