0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

7の倍数

Posted at

#問題文
1以上10N以下の整数のうち7の倍数の割合を求めよ。

#ソース

<?php
//入力値
$nyu = "4";
//乗算対象数値
$ten = 10;
//乗算
$jyo = pow($ten,$nyu);
//7を割る 小数点は切り上げ
$total = $jyo / 7;
$total = floor($total);
//7の倍数の割合計算
$kekka = $total / $jyo;

echo $kekka;

?>
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?