Skip to content

Instantly share code, notes, and snippets.

@nbervar21
Last active October 17, 2019 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nbervar21/36e25645d7d2565e4ce67fb89cab1cd5 to your computer and use it in GitHub Desktop.
Save nbervar21/36e25645d7d2565e4ce67fb89cab1cd5 to your computer and use it in GitHub Desktop.
cs50 oneline mario
// mario.c by Nick Bervar (2019)
#include <stdio.h>
#include <stdlib.h>
int main(int c, char *v[])
{
for (int i = 1, s = c > 1 ? atoi(v[1]) : 6, g = c > 2 ? atoi(v[2]) : 2; i <= s; i++)
{
for (int j = 1, m = g + (s * 2); j <= m + 1; j += (printf(j < m + 1 ? ((j <= s - i || j > s + g + i || (j > s && j <= s + g)) ? " " : "#") : "\n") * 0) + 1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment