Note: 1, set the variable for floating point, 2, and result output keep two decimal places
CodePudding user response:
Float sum=0.0;for (int i=0; I & lt; 50; I++)
{
The sum +=(float) 1/(2 * I + 1);
}
Printf (" %. 02 f \ n ", sum);
CodePudding user response:
Such as 1/f, you can also use the sum +=1.0/(2 * I + 1);