Last active
November 23, 2024 17:15
-
-
Save willeccles/cbf245f180bb0f1ecee122a8a5c25ed1 to your computer and use it in GitHub Desktop.
A C program which is also a valid bash script, and vice versa.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define $x ,x | |
#define $i ,i | |
#define eval int | |
#define read scanf | |
#define $scanfpat "%d", & | |
#define $(x) ,(x) | |
#define $open ( | |
#define $close ) | |
#define do { | |
#define done } | |
#define then { | |
#define fi } | |
#define else } else { | |
main() { | |
eval i=0; | |
eval x=7; | |
read $open $scanfpat x $close; | |
for (( i = 0 $close; i < 5; $open i++ )) | |
do | |
printf $open "%d\n" $((x+i)) $close; | |
done | |
if (( x % 2 )) | |
then | |
printf $open "%d is odd\n" $x $close; | |
fi | |
for (( i = 1 $close; i <= 100; $open i++ )) | |
do | |
if (( i % 3 )) | |
then | |
if (( i % 5 )) | |
then | |
printf $open "%d\n" $i $close; | |
else | |
printf $open "buzz\n" $close; | |
fi | |
else | |
if (( i % 5 )) | |
then | |
printf $open "fizz\n" $close; | |
else | |
printf $open "fizzbuzz\n" $close; | |
fi | |
fi | |
done | |
return 0; | |
} | |
#if 0 | |
main | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment