I wrote some program in C language. I have to calculate sum of squares. My book suggested me to use loops but I chose more efficient way by using formula: $$1^2+2^2+\cdots+n^2=\frac{n\left(n+1\right)\left(2n+1\right)}{6}$$ Original code from listing 5.13: <!-- language: c --> > #include <stdio.h> > > int main(void) { > int licznik, suma; > > licznik = 0; > suma = 0; > while (licznik++ < 20) > suma = suma + licznik; > printf("suma = %d\n", suma); > return 0; > } Finally, this is my code: <!-- language: c --> #include <stdio.h> int main(void) { int zakres; printf("Podaj zakres przeprowadzanych obliczen:\n"); scanf("%i", &zakres); printf("suma kwadratow = %d\n", (((zakres * (zakres + 1)) * (2 * zakres + 1)) / 6)); return 0; } What do you think about this solution? Is it more efficient than loops?