Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

66%
+2 −0
Challenges 99 Shortened Bottles of Beer

C (gcc), 244 bytes main(){for(char*w=" bottles of beer on the wall",i=100;--i;)printf("%d%.*s%s, %d%.*s%.8s.\n%s, %d%.*s%s.\n\n",i,i-1?8:7,w,w+8,i,i-1?8:7,w,w+8,i^1?"Take one down and pass it ar...

posted 3y ago by Lundin‭  ·  last activity 3y ago by Lundin‭

Answer
#4: Post undeleted by user avatar Lundin‭ · 2021-08-23T13:38:20Z (over 3 years ago)
#3: Post edited by user avatar Lundin‭ · 2021-08-23T13:38:10Z (over 3 years ago)
  • # [C (gcc)], 246 bytes
  • Full program, gcc extensions.
  • <!-- language-all: lang-c -->
  • main(){for(char*w=" bottles of beer on the wall",i=100;--i;)printf("%d%.*s%s, %d%.*s%.8s.
  • %s, %d%.*s%.8s.
  • ",i,i-1?8:7,w,w+8,i,i-1?8:7,w,w+8,i^1?"Take one down and pass it around":"Go to the store and buy some more",i^1?i-1:99,i^2?8:7,w,w+8);}
  • [Try it online!][TIO-ksoo5z7w]
  • [C (gcc)]: https://gcc.gnu.org/
  • [TIO-ksoo5z7w]: https://tio.run/##ZU5LCoMwFLzKIyCojaLd1A/ishfoUgpRYw3VPEkioZSe3QYpdOFuZphfFz26bttmJqQfvAdUfjcyFdqKQIvGTFwDDtByrgAlmJGDZdNEqKjSJCmjSJTBooQ0g0@83otD7WkKPxRnOm7kQWiki1MRpXVWXKil9pQd@T2tyY09uVvl0KOVwGQPC9MahAGmcJU9KcgVweB@SxtUfDe16ws0zhxmp5C9ypUXee7g@b8RlJ9t@wI "C (gcc) – Try It Online"
  • # [C (gcc)], 244 bytes
  • <!-- language-all: lang-c -->
  • main(){for(char*w=" bottles of beer on the wall",i=100;--i;)printf("%d%.*s%s, %d%.*s%.8s.
  • %s, %d%.*s%s.
  • ",i,i-1?8:7,w,w+8,i,i-1?8:7,w,w+8,i^1?"Take one down and pass it around":"Go to the store and buy some more",i^1?i-1:99,i^2?8:7,w,w+8);}
  • [Try it online!][TIO-ksoooaj2]
  • [C (gcc)]: https://gcc.gnu.org/
  • [TIO-ksoooaj2]: https://tio.run/##ZU7dCoIwGH2Vj4GgNUW7yR/Ey16gSwmmzhzpPtkmI6JntyVBQXfnHM5fG17bdl0nJqQfPHpUfjswtbMlgQaNGbkG7KHhXAFKMAMHy8aRUFEmcVyEoSiCWQlpep94nRfttKcpfFCU6qiWP8Kb1tKFqQiTKs2P1FK7T//5JanImd242@TQoZXAZAcz0xqEAaZwkR3JyQnB4HZKG1R8MzXLHTROHCankK3KledZ5uDhuxEUz3V9AQ "C (gcc) – Try It Online"
  • Full program, gcc extensions.
#2: Post deleted by user avatar Lundin‭ · 2021-08-23T13:34:44Z (over 3 years ago)
#1: Initial revision by user avatar Lundin‭ · 2021-08-23T13:24:02Z (over 3 years ago)
# [C (gcc)], 246 bytes

Full program, gcc extensions.

<!-- language-all: lang-c -->

    main(){for(char*w=" bottles of beer on the wall",i=100;--i;)printf("%d%.*s%s, %d%.*s%.8s.\n%s, %d%.*s%.8s.\n\n",i,i-1?8:7,w,w+8,i,i-1?8:7,w,w+8,i^1?"Take one down and pass it around":"Go to the store and buy some more",i^1?i-1:99,i^2?8:7,w,w+8);}

[Try it online!][TIO-ksoo5z7w]

[C (gcc)]: https://gcc.gnu.org/
[TIO-ksoo5z7w]: https://tio.run/##ZU5LCoMwFLzKIyCojaLd1A/ishfoUgpRYw3VPEkioZSe3QYpdOFuZphfFz26bttmJqQfvAdUfjcyFdqKQIvGTFwDDtByrgAlmJGDZdNEqKjSJCmjSJTBooQ0g0@83otD7WkKPxRnOm7kQWiki1MRpXVWXKil9pQd@T2tyY09uVvl0KOVwGQPC9MahAGmcJU9KcgVweB@SxtUfDe16ws0zhxmp5C9ypUXee7g@b8RlJ9t@wI "C (gcc) – Try It Online"