/* Collection of code snippets by Arne Vajhøj */
/* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) */
#include <stdio.h>
#include <time.h>

const int N = 1000000000;

int main()
{
  int i, sum;
  time_t t1, t2;
  t1 = time(NULL);
  sum = 0;
  for(i = 0; i < N; i++) {
      sum = ((sum + 1) * 2 + 1) / 2;
  }
  t2 = time(NULL);
  if(sum != N) {
      printf("Error\n");
  } else {
      printf("%d operations in %d seconds", N, t2 - t1);
  }
}
