Sha256: 94d64f4f44ad6287f3e93f18c315c4e2dcc70d93b4f02b9e6d038a6ec4d69633

Contents?: true

Size: 497 Bytes

Versions: 396

Compression:

Stored size: 497 Bytes

Contents

#include "difference_of_squares.h"

unsigned int sum_of_squares(unsigned int number)
{
   unsigned int sum = 0;

   for (unsigned int i = 0; i <= number; i++) {
      sum += i * i;
   }

   return sum;
}

unsigned int square_of_sum(unsigned int number)
{
   unsigned int sum = 0;

   for (unsigned int i = 0; i <= number; i++) {
      sum += i;
   }

   return (sum * sum);
}

unsigned int difference_of_squares(unsigned int number)
{
   return (square_of_sum(number) - sum_of_squares(number));
}

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.179 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.178 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.177 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.176 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.175 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.174 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.173 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.172 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.171 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.170 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.169 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.167 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.166 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.165 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.164 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.163 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.162 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.161 tracks/c/exercises/difference-of-squares/src/example.c
trackler-2.2.1.160 tracks/c/exercises/difference-of-squares/src/example.c