Rectangle Area Function
PHP
Easy
4 views
Problem Description
Write area(w,h) and print the rectangle area.
Input Format
One line: w h.
Output Format
One integer area.
Official Solution
<?php
$inputText=trim(stream_get_contents(STDIN));
if($inputText==='') exit;
[$w,$h]=array_map('intval',preg_split('/\\s+/', $inputText));
function area($w,$h){ return $w*$h; }
echo area($w,$h);
?>
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!