c语言学习

17 阅读1分钟
	
	double s = 0;
	int i = 1;
	while(i <= 19){
		
		printf("%d \n", i);
		if(i%2==0){
		  s -=1.0/i;
		} else{
		  s += 1.0/i;		
		}	
		i++;
	}
	printf("s=%f \n",s);
	
	return 0;
} 

image.png