Post History
C (gcc), 147 151 bytes #define L(X)X(+,a+b)X(-,a-b)X(*,a*b)X(/,b&&a/b)X(%,b&&a%b)X(^,pow(a,b)) #define M(o,d)printf("%s",d==c?#o" ":z++==5?".":""); z;s[99];f(a,b,c){L(M)} Tr...
Answer
#2: Post edited
# [C (gcc)], 151 bytes- <!-- language-all: lang-c -->
- #define L(X)X(+,a+b)X(-,a-b)X(*,a*b)X(/,b&&a/b)X(%,b&&a%b)X(^,pow(a,b))
#define M(o,d)strcat(s,d==c?#o" ":"");s[99];f(a,b,c){L(M)*s=*s?*s:46;puts(s);}[Try it online!][TIO-kui3izaw]- [C (gcc)]: https://gcc.gnu.org/
[TIO-kui3izaw]: https://tio.run/##XY1Ri8IwEITf@ytCRdmNG6y96llD8Q/ou3DcQZpaKWgrpuqD@NeNieBRfZrZj5kdLbZaW9srNmVVb9gS1riGIalh7lSQEl45Ke51RPlgoEbe9p@27@0fHZoLKMoRg9efFTRUoGmPWrVgqMgyveg1IQvnYYgyMD9p@itLXyKN1yWskJuMmwU382QqD6fWgEF5s1Xdsr2qagbnpiowuAaMlRDTF01Qukokn@DbgbgLUppR0gVjit8T7vxIJDSlWZdMKHrvRA6Mu8CNUPSZ@Ac3e9flTm2NFbu9FZcH "C (gcc) – Try It Online"- Somewhat naive solution with X macros that builds up a string before printing. The `b&&a/b` checks are there to deal with division by zero.
- # [C (gcc)], 147 <strike>151</strike> bytes
- <!-- language-all: lang-c -->
- #define L(X)X(+,a+b)X(-,a-b)X(*,a*b)X(/,b&&a/b)X(%,b&&a%b)X(^,pow(a,b))
- #define M(o,d)printf("%s",d==c?#o" ":z++==5?".":"");
- z;s[99];f(a,b,c){L(M)}
- [Try it online!][TIO-kui7oijr]
- [C (gcc)]: https://gcc.gnu.org/
- [TIO-kui7oijr]: https://tio.run/##fY7BisIwFEX3/YoQqSTti9aOVWsI/oDuhWEG0tRIQdsycRQq/rqZRJid7eJxLxzO5Sl2VMraUXnQVX1AW7KnexKDjAuXDCTzGYGMfE6hGI/l1NfwVUNfv6FtbkRCQWnwv7MjDZS0/anqiyY4NBhKIdRm1GCE110cC5Ft8ASvMaY86Lj5zPMvrv0IKHrfkh19WOeis6xqRK5NVdLgHiCkSQofkFEeGZHwzl37ezHkNePp0tG0l@awgnkvnUE64Do25M5hAatenEEyMJ04Ouul7mVIBt339GGfSp/k0Vh2Olt2@wM "C (gcc) – Try It Online"
- Somewhat naive solution with X macros that builds up a string before printing. The `b&&a/b` checks are there to deal with division by zero.
#1: Initial revision
# [C (gcc)], 151 bytes <!-- language-all: lang-c --> #define L(X)X(+,a+b)X(-,a-b)X(*,a*b)X(/,b&&a/b)X(%,b&&a%b)X(^,pow(a,b)) #define M(o,d)strcat(s,d==c?#o" ":""); s[99];f(a,b,c){L(M)*s=*s?*s:46;puts(s);} [Try it online!][TIO-kui3izaw] [C (gcc)]: https://gcc.gnu.org/ [TIO-kui3izaw]: https://tio.run/##XY1Ri8IwEITf@ytCRdmNG6y96llD8Q/ou3DcQZpaKWgrpuqD@NeNieBRfZrZj5kdLbZaW9srNmVVb9gS1riGIalh7lSQEl45Ke51RPlgoEbe9p@27@0fHZoLKMoRg9efFTRUoGmPWrVgqMgyveg1IQvnYYgyMD9p@itLXyKN1yWskJuMmwU382QqD6fWgEF5s1Xdsr2qagbnpiowuAaMlRDTF01Qukokn@DbgbgLUppR0gVjit8T7vxIJDSlWZdMKHrvRA6Mu8CNUPSZ@Ac3e9flTm2NFbu9FZcH "C (gcc) – Try It Online" Somewhat naive solution with X macros that builds up a string before printing. The `b&&a/b` checks are there to deal with division by zero.