Problem Description :
The sum of the squares of the first ten natural numbers is,
12 + 22 + ... + 102 = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)2 = 552 = 3025
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2640.
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
খুবই বাংলা প্রবলেম ক্লাস 8/9 এর পোলাপানেরাও পারবে। n(n+1)/2 এই ফর্মুলা ব্যাবহার করা হইসে বাকিটা সহজ যে কেউ পড়লেই বুঝবে ।
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<math.h> | |
int main() | |
{ | |
int n=100,i,j=0,k,sum; | |
k=n*(n+1); | |
sum=pow(k/2,2); | |
printf("%d ",sum); | |
for(i=1;i<=100;i++){ | |
j=j+pow(i,2); | |
} | |
printf("\n%d \n",j); | |
printf("Difference : %d \n",sum-j); | |
return 0; | |
} |