Guest User

Untitled

a guest
Jul 18th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. double foo(double *a, int n) {
  2. double x = 0.0;
  3. double y = 0.0;
  4. for (int i = 0; i < n; i += 2) {
  5. x += a[i];
  6. y += a[i + 1];
  7. }
  8. return x * y;
  9. }
  10.  
  11. double bar(double *a, unsigned n) {
  12. double x = 0.0;
  13. double y = 0.0;
  14. for (unsigned i = 0; i < n; i += 2) {
  15. x += a[i];
  16. y += a[i + 1];
  17. }
  18. return x * y;
  19. }
Add Comment
Please, Sign In to add comment