#include <stdio.h>
int main()
{
int n, i, sum = 0;
printf("ENTER A POSITIVE NUMBER:");
scanf("%d", &n);
for (i = 1; i <= n; ++i)
{
sum=sum+ i*i;
}
printf("SUM OF SQUARE OF FIRST %d NATURAL NUMBERS = %d",n, sum);
return 0;
}
Execution
For students : you can download and use Dev c++ compiler for executing this program.