Advertisement
paulogp

Sequence (1, 4, 9, 16, 25, ...)

Oct 2nd, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.21 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6.     for (int i = 1; i <= 100; i = (int)pow((sqrt((double)i)+1), 2))
  7.     {
  8.         printf("%i, ", i);
  9.         // 1, 4, 9, 16, 25, 36, 49, 64, 81, 100
  10.     }
  11.  
  12.     return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement