Guest User

Untitled

a guest
Jun 24th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stdint.h>
  4.  
  5. int main(int argc, char** argv)
  6. {
  7. uint32_t f, s, t, x;
  8. uint64_t m;
  9.  
  10. if(argc > 1 && (x = atoi(argv[1])) > 0)
  11. {
  12. f = 0;
  13. s = 1;
  14. t = 0;
  15. m = 1;
  16.  
  17. for(;;)
  18. {
  19. t = f + s;
  20. f = s;
  21. s = t;
  22.  
  23. if(s >= x) { break; }
  24.  
  25. m += s;
  26. }
  27.  
  28. printf("Sum: %llu\n", m);
  29. }
  30.  
  31. return 0;
  32. }
Add Comment
Please, Sign In to add comment