编程计算:1x2x3+3x4x5+...+99x100x101的值。请用for循环实现 用code blocks编写谢谢

2025-01-04 01:32:35
推荐回答(1个)
回答1:

#include
int main()
{
unsigned long lValue = 0;
for(int i = 1; i <= 99; i+= 2)
{
lValue += i*(i+1)*(i+2);
}
printf("Value is %ld.\n", lValue);
return 0;
}