Skip to main content
266!!!!
Source Link
roblogic
  • 4k
  • 18
  • 23

Fortran (GFortran) -cpp, 304409.. 266 bytes

#define w' on the wall'
#define p trim(x)i,trim(b)
character' bottle',char(16n)a,b,x;a=' bottles' of beer';b=abeer'
do#define 5q print"(*(g0))"
n=115;do5 i=99,1,-1;write(x,'(i0)')i;if1;if(i<2)b=' bottle of beer'n=0
if(i<99)print*q,'Take one down, pass it around, ',p,w,'.',new_line(xw)
5 print*q,p,w,', ',p,'.'
print*n=115;i=99;q,'Go to the store and buy some more, 99'',ap,w,'.';end

Try it online!Try it online!

The -cpp option allows me to #define macros.

  • -cpp allows me to #define macros
  • macro p uses ASCII conversion, so a character variable 's' isn't needed
  • macro q formats integers nicely, so a conversion of i to string isn't needed
  • loop do5 (ungolfed do 5) loops around to label 5 two lines below

Fortran (GFortran) -cpp, 304 bytes

#define w' on the wall'
#define p trim(x),trim(b)
character(16)a,b,x;a=' bottles of beer';b=a
do 5 i=99,1,-1;write(x,'(i0)')i;if(i<2)b=' bottle of beer'
if(i<99)print*,'Take one down, pass it around, ',p,w,'.',new_line(x)
5 print*,p,w,', ',p,'.'
print*,'Go to the store and buy some more, 99',a,w,'.';end

Try it online!

The -cpp option allows me to #define macros.

Fortran (GFortran) -cpp, 409.. 266 bytes

#define w' on the wall'
#define p i,' bottle',char(n),' of beer'
#define q print"(*(g0))"
n=115;do5 i=99,1,-1;if(i<2)n=0
if(i<99)q,'Take one down, pass it around, ',p,w,'.',new_line(w)
5 q,p,w,', ',p,'.'
n=115;i=99;q,'Go to the store and buy some more, ',p,w,'.';end

Try it online!

  • -cpp allows me to #define macros
  • macro p uses ASCII conversion, so a character variable 's' isn't needed
  • macro q formats integers nicely, so a conversion of i to string isn't needed
  • loop do5 (ungolfed do 5) loops around to label 5 two lines below
-2
Source Link
roblogic
  • 4k
  • 18
  • 23

Fortran (GFortran) -cpp, 306304 bytes

#define w' on the wall'
#define p trim(x),trim(b)
character(16)a,b,x
a='x;a=' bottles of beer';b=a
do 5 i=99,1,-1
write1;write(x,'(i0)')i
ifi;if(i<2)b=' bottle of beer'
if(i<99)print*,'Take one down, pass it around, ',p,w,'.',new_line(x)
5 print*,p,w,', ',p,'.'
enddo
print*,'Go to the store and buy some more, 99',a,w,'.'
end';end

Try it online!Try it online!

The -cpp option allows me to #define macros.

Fortran (GFortran) -cpp, 306 bytes

#define w' on the wall'
#define p trim(x),trim(b)
character(16)a,b,x
a=' bottles of beer';b=a
do i=99,1,-1
write(x,'(i0)')i
if(i<2)b=' bottle of beer'
if(i<99)print*,'Take one down, pass it around, ',p,w,'.',new_line(x)
print*,p,w,', ',p,'.'
enddo
print*,'Go to the store and buy some more, 99',a,w,'.'
end

Try it online!

The -cpp option allows me to #define macros.

Fortran (GFortran) -cpp, 304 bytes

#define w' on the wall'
#define p trim(x),trim(b)
character(16)a,b,x;a=' bottles of beer';b=a
do 5 i=99,1,-1;write(x,'(i0)')i;if(i<2)b=' bottle of beer'
if(i<99)print*,'Take one down, pass it around, ',p,w,'.',new_line(x)
5 print*,p,w,', ',p,'.'
print*,'Go to the store and buy some more, 99',a,w,'.';end

Try it online!

The -cpp option allows me to #define macros.

-6
Source Link
roblogic
  • 4k
  • 18
  • 23

Fortran (GFortran) -cpp, 409... 312306 bytes

#define w' on the wall'
#define p trim(x),trim(b)
character(16)a,b,c,x
a=' bottles of beer';b=a;c=' bottle of beer'beer';b=a
do i=99,1,-1
write(x,'(i0)')i
if(i<2)b=cb=' bottle of beer'
if(i<99)print*,'Take one down, pass it around, ',p,w,'.',new_line(x)
print*,p,w,', ',p,'.'
enddo
print*,'Go to the store and buy some more, 99',a,w,'.'
end

Try it online!Try it online!

The -cpp option allows me to #define macros. Maybe one day Fortran will have stretchy strings but for now I have to use trim() everywhere.

Fortran (GFortran) -cpp, 409... 312 bytes

#define w' on the wall'
#define p trim(x),trim(b)
character(16)a,b,c,x
a=' bottles of beer';b=a;c=' bottle of beer'
do i=99,1,-1
write(x,'(i0)')i
if(i<2)b=c
if(i<99)print*,'Take one down, pass it around, ',p,w,'.',new_line(x)
print*,p,w,', ',p,'.'
enddo
print*,'Go to the store and buy some more, 99',a,w,'.'
end

Try it online!

The -cpp option allows me to #define macros. Maybe one day Fortran will have stretchy strings but for now I have to use trim() everywhere.

Fortran (GFortran) -cpp, 306 bytes

#define w' on the wall'
#define p trim(x),trim(b)
character(16)a,b,x
a=' bottles of beer';b=a
do i=99,1,-1
write(x,'(i0)')i
if(i<2)b=' bottle of beer'
if(i<99)print*,'Take one down, pass it around, ',p,w,'.',new_line(x)
print*,p,w,', ',p,'.'
enddo
print*,'Go to the store and buy some more, 99',a,w,'.'
end

Try it online!

The -cpp option allows me to #define macros.

fix bug
Source Link
roblogic
  • 4k
  • 18
  • 23
Loading
added 324 characters in body
Source Link
roblogic
  • 4k
  • 18
  • 23
Loading
correction
Source Link
roblogic
  • 4k
  • 18
  • 23
Loading
deleted 140 characters in body
Source Link
roblogic
  • 4k
  • 18
  • 23
Loading
deleted 9 characters in body
Source Link
roblogic
  • 4k
  • 18
  • 23
Loading
added 19 characters in body
Source Link
roblogic
  • 4k
  • 18
  • 23
Loading
added 1 character in body
Source Link
roblogic
  • 4k
  • 18
  • 23
Loading
deleted 34 characters in body
Source Link
roblogic
  • 4k
  • 18
  • 23
Loading
Source Link
roblogic
  • 4k
  • 18
  • 23
Loading