#include <iostream> #include<cmath> #include<ctime> #include<string> #include <iomanip> #include <fstream> using namespace std; int main() { int number; cin >> number; for (int i = 0; i <=number; i++) { for (int j = 0; j <= number; j++) { if ( i == 0 || i == number || i == number/2|| j == number/2|| j == 0 || j == number || i == j || j == (number - i + 0) ) cout <<" "<< "*"; else cout << " "; int h = (number - i + 1); } cout << "\n"; } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter