NastySwipy

Coding 101 Exam - 6 March 2016 - 05. Draw Fort

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