Basic Arithmetic Trio
PHP
Easy
4 views
Problem Description
Given a and b, print a+b, a-b, and a*b on one line.
Input Format
One line: a b.
Output Format
Three integers.
Official Solution
<?php
$inputText=trim(stream_get_contents(STDIN));
if($inputText==='') exit;
[$a,$b]=array_map('intval',preg_split('/\\s+/', $inputText));
echo ($a+$b).' '.($a-$b).' '.($a*$b);
?>
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!