Skip to content

Instantly share code, notes, and snippets.

@vivanov1410
Created May 9, 2013 00:36
Show Gist options
  • Select an option

  • Save vivanov1410/5544744 to your computer and use it in GitHub Desktop.

Select an option

Save vivanov1410/5544744 to your computer and use it in GitHub Desktop.
Solution for tasuku 3 Fiby
// tasuku3.c
#include <stdio.h>
#define MAX_LIMIT 4000000
int main(int argc, char const *argv[]) {
// counter for basic operations
int counter = 0;
int sum = 0;
int a = 2, b = 3, c = 5;
while(a < MAX_LIMIT) {
sum += a;
a = b + c;
b = a + c;
c = a + b;
// basic operation here is summation
counter += 3;
}
printf("Answer is %d\n", sum);
printf("Total basic operation are %i\n", counter);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment