CS 2073 Engineering Programming
|
You should also review your work for the programming assignments:
double temperature = 98.6; /* or = 104.2 or = 94.0 */ /* put the rest of the code below */
int i = 1;
int sum = 0;
while (i < 10) {
sum = sum + i*i;
i++;
}
printf("sum: %i", sum);
int k;
for (k = 10; k >= 1; k--) {
printf("%i", k);
if (k != 10) printf(", ");
}
printf("\n");
1 + 1/22 + 1/32 + 1/42 + 1/52 + ...
a0 = 2*sqrt(3); b0 = 3; a1 = 2*a0*b0/(a0 + b0); b1 = sqrt(a1*b0);
Then replace a1 and b1 by a0 and b0, and repeat the last two equations. Keep repeating until a1 and b1 are within 1.0e-15 of one another. The final answer should be the average of a1 and b1.