Skip to main content
added 204 characters in body
Source Link
roblogic
  • 4k
  • 18
  • 23

Fortran (GFortran), 3535 28 bytes

Try it online!

read*,n;print*,sum([n*(j,j=1,n)]n+1);end/2;end
 

Try it online!Old (but kinda fun) solution: Construct inline anonymous array, sum, and print.

read*,n;print*,sum([(j,j=1,n)]);end

Fortran (GFortran), 35 bytes

read*,n;print*,sum([(j,j=1,n)]);end

Try it online! Construct inline anonymous array, sum, and print.

Fortran (GFortran), 35 28 bytes

Try it online!

read*,n;print*,n*(n+1)/2;end
 

Old (but kinda fun) solution: Construct inline anonymous array, sum, and print.

read*,n;print*,sum([(j,j=1,n)]);end
Source Link
roblogic
  • 4k
  • 18
  • 23

Fortran (GFortran), 35 bytes

read*,n;print*,sum([(j,j=1,n)]);end

Try it online! Construct inline anonymous array, sum, and print.