摘要: 006.前十个自然数的平方和是:1^2 + 2^2 + ... + 10^2 = 385前十个自然数的和的平方是:(1 + 2 + ... + 10)^2 = 55^2 = 3025所以平方和与和的平方的差是3025 -385 = 2640.找出前一百个自然数的平方和与和平方的差。代码如下:#include <stdio.h>#include <stdlib.h>#include <math.h>#define N 100int main (void){ int i,j; double n=0,m=0; for(i=1;i<=N;i++) n=n+po 阅读全文
posted @ 2013-03-19 22:11 要我安静从容 阅读(136) 评论(0) 推荐(0) 编辑