NastySwipy

Coding 101 Exam - 26 March 2016 - Задача 05 - Пеперуда

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