Skip to content

Instantly share code, notes, and snippets.

@mihaimaruseac
Created April 6, 2018 13:34
Show Gist options
  • Save mihaimaruseac/3e38592a6ab6981821aa0d0567305800 to your computer and use it in GitHub Desktop.
Save mihaimaruseac/3e38592a6ab6981821aa0d0567305800 to your computer and use it in GitHub Desktop.
Was asked to solve the problem on https://www.facebook.com/ProgrammersCreateLife/photos/a.241809332534619.55240.241806149201604/1662976313751240/?type=3 Could be improved even more, but that's for when I'll have my own blog.
#include <stdio.h>
#include <stdlib.h>
int main()
{
const int sz = 10;
for (int i = 0; i < sz; i++) {
for (int j = 0; j < sz; j++) {
if (i == 0 || i == sz - 1)
printf("#");
else if (j == 0 || j == sz - 1)
printf("#");
else if (i == j || i + j == sz - 1)
printf("#");
else
printf(" ");
}
printf("\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment