Skip to main content
added 358 characters in body
Source Link
roblogic
  • 4.6k
  • 21
  • 24

Fortran (GFortran), 8585 80 bytes

subroutinefunction d(A,n,e);real A(n,2);s=0;do 5;s=0;do5 i=1,n;s=s+(A(i,1)-A(i,2))**2 5 e=sqrtd=sqrt(s);end 

Try it online!.Try it online!   85 bytes

Instead of two vectors, I read all the data into two rows of array A. But Fortran 'helpfully' stores matrices by column so when I call the procedure A is transposed. Using line number 5 instead of enddo saves 2 bytes :)
Using line number 5 instead of enddo saves 2 bytes :)
Saved 5 bytes using function instead of subroutine

Fortran (GFortran), 85 bytes

subroutine d(A,n,e);real A(n,2);s=0;do 5 i=1,n;s=s+(A(i,1)-A(i,2))**2 5 e=sqrt(s);end 

Try it online!. Instead of two vectors, I read all the data into two rows of array A. But Fortran 'helpfully' stores matrices by column so when I call the procedure A is transposed. Using line number 5 instead of enddo saves 2 bytes :)

Fortran (GFortran), 85 80 bytes

function d(A,n);real A(n,2);s=0;do5 i=1,n;s=s+(A(i,1)-A(i,2))**2 5 d=sqrt(s);end 

Try it online!   85 bytes

Instead of two vectors, I read all the data into two rows of array A. But Fortran 'helpfully' stores matrices by column so when I call the procedure A is transposed.
Using line number 5 instead of enddo saves 2 bytes :)
Saved 5 bytes using function instead of subroutine

Source Link
roblogic
  • 4.6k
  • 21
  • 24

Fortran (GFortran), 85 bytes

subroutine d(A,n,e);real A(n,2);s=0;do 5 i=1,n;s=s+(A(i,1)-A(i,2))**2 5 e=sqrt(s);end 

Try it online!. Instead of two vectors, I read all the data into two rows of array A. But Fortran 'helpfully' stores matrices by column so when I call the procedure A is transposed. Using line number 5 instead of enddo saves 2 bytes :)