Sha256: 546d0d1fa4a1e3c246cca8ab5bd72dc1f860bfc2f74806758de6f0260466197f

Contents?: true

Size: 285 Bytes

Versions: 81

Compression:

Stored size: 285 Bytes

Contents

#include "grains.h"

#define NUMBER_OF_SQUARES   (64)

uint64_t square(uint8_t index)
{
   return (uint64_t) 1 << (index - 1);
}

uint64_t total(void)
{
   uint64_t result = 0;

   for (uint8_t i = 1; i <= NUMBER_OF_SQUARES; i++) {
      result += square(i);
   }

   return result;
}

Version data entries

81 entries across 81 versions & 1 rubygems

Version Path
trackler-2.0.6.25 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.24 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.23 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.22 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.21 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.20 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.19 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.18 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.17 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.16 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.15 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.14 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.13 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.12 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.11 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.10 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.9 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.8 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.7 tracks/c/exercises/grains/src/example.c
trackler-2.0.6.6 tracks/c/exercises/grains/src/example.c