Język Pascal uses crt; var a:integer; begin a:=99; repeat write(a); write(' bottles of beer on the wall, '); write(a); write(' bottles of beer. Take one down and pass it around - '); a:=a-1; write(a); writeln('bottles of beer on the wall.'); until a=2; writeln('2 bottles of beer on the wall, 2 bottles of beer. Take one down and pass it around - 1 bottle of beer on the wall.'); writeln('1 bottle of beer on the wall, 1 bottle of beer. Take it down and pass it around - no more bottles of beer on the wall.');
repeat until keypressed; end.
Język C++ #include <iostream>
using namespace std;
int main() { int x = 99; while (x > 0)
if (x > 2)
cout << x << " bottles of beer on the wall, " << x << " bottles of beer. " << "Take one down and pass it around - " << x - 1 << " bottles of beer on the wall.\n";
else if (x == 2)
cout << x << " bottles of beer on the wall, " << x << " bottles of beer. " << "Take one down and pass it around - " << x - 1 << " bottle of beer on the wall.\n";
else
cout << x << " bottle of beer on the wall, " << x << " bottle of beer. " << "Take one down and pass it around - no more bottles of beer on the wall.\n";
x--;
Język C# using System;