(50 pts) use for-loop to do the following tasks: calculate 6 * (1 + ¼ + 1/9 + 1/16 + … + 1/(1000*1000)). Note: the denominate is a squared number. Your answer should be very close to PI (3.1415926…).
2. (50 pts) use for-loop to print out the following 10x10 figure on screen:
thanks you guys. I wasn't asking someone to do my work for me. I know this isn't a homework site. Doing both individually isn't the hard part for me. Its getting the two to work together. I will be happy to post my code but I know other classmates troll this site looking for someone to do their work for them instead of trying to figure out the problem. It has happened to me already. I can PM it if you want to see what I have come up with thus far. Again gents, I'm not looking for answers just guidance.
#include <iostream>
#include <iomanip>
int main()
{
double sum = 0;
for( int i = 1; i < 1001; i++ )
sum += (double)1/(i*i);
std::cout << 6 * sum << std::endl;
int num = 123456789;
for( int i = 0; i < 10; i++ )
{
std::cout << std::setfill('0') << std::setw(10) << num << std::endl;
num /= 10;
}
return 0;
}