LoginSignup
1
0

More than 1 year has passed since last update.

【PHP基礎復習9】掛け算と割り算

Posted at

[問題]
モモさんは毎朝、近所にあるお城のお堀の周りをジョギングしています。
1周Aメートルのお堀をB周した場合、合計何キロメートルになるか求めなさい。

コード

$input_1 = fgets(STDIN);
$input_2 = fgets(STDIN);
echo $input_1 * $input_2 /1000, PHP_EOL;

↓ 1000、3と入力

結果

3

★何キロメートルかと聞かれているので、1000で割る。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0