fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. int p = 3, q = -1, r, i = 1;
  6. printf("The first ten numbers of the Lucas series are:\n");
  7. while(i < 11)
  8. {
  9. r = p + q;
  10. printf("%d\n",r);
  11. p = q;
  12. q = r;
  13. i++;
  14. }
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 4316KB
stdin
Standard input is empty
stdout
The first ten numbers of the Lucas series are:
2
1
3
4
7
11
18
29
47
76