求前一百的自然数和的平方与平方和的差
原题目:
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
比较简单,直接上代码
#include<iostream>
using namespace std;
int main()
{
int a=0, b=0;
for (int i = 1; i <= 100; i++)
{
a = a + i * i;
b += i;
}
cout << b * b - a ;
}