NastySwipy

Exam - 7 May 2017 - 05. Crown

Feb 25th, 2018
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1. $num = intval(readline());
  2. echo "@" . str_repeat(" ", $num - 2) . "@" . str_repeat(" ", $num - 2) . "@\n";
  3. echo "**" . str_repeat(" ", $num - 3) . "*" . str_repeat(" ", $num - 3) . "**\n";
  4. for ($i = 0; $i < $num / 2 - 2; $i++) {
  5.     echo "*" . str_repeat(".", $i + 1) . "*" . str_repeat(" ", $num - 5 - 2 * $i)
  6.     . "*" . str_repeat(".", 1 + 2 * $i) . "*" . str_repeat(" ", $num - 5 - 2 * $i)
  7.     . "*" . str_repeat(".", $i + 1) . "*\n";
  8. }
  9. echo "*" . str_repeat(".", $num / 2 - 1) . "*" . str_repeat(".", $num & 1 ? $num - 2 : $num - 3)
  10.  . "*" . str_repeat(".", $num / 2 - 1) . "*\n";
  11. echo "*" . str_repeat(".", $num / 2) . str_repeat("*", $num & 1 ? $num / 2 - 1 : $num / 2 - 2)
  12.  . "." . str_repeat("*", $num & 1 ? $num / 2 - 1 : $num / 2 - 2) . str_repeat(".", $num / 2) . "*\n";
  13. echo str_repeat("*", $num * 2 - 1) . "\n" . str_repeat("*", $num * 2 - 1);
Advertisement
Add Comment
Please, Sign In to add comment