Differences between revisions 5 and 6
Revision 5 as of 2018-10-10 13:09:26
Size: 2560
Comment:
Revision 6 as of 2018-10-10 13:33:05
Size: 2642
Comment:
Deletions are marked like this. Additions are marked like this.
Line 50: Line 50:
 * [[attachment:Python/Prog/Example/02/xxxx|xxxx]]  * [[attachment:Python/Prog/Example/02/Ex_02_009a_greatest_common_divisor_builtin.py|Ex_02_009a_greatest_common_divisor_builtin.py]]

例題(9)

   1 import math
   2 
   3 print( math.gcd( 350, 450 ) )
  • 例題ファイルとしては,コメントを付け加えた,下記を配布します.
    • コメントはもう少し増えるかもしれません.

   1 #!/usr/bin/env python
   2 # -*- coding: utf-8 -*-
   3 # ==============================================================================
   4 # * Copyright (c) 2018 IIJIMA, Tadashi
   5 # *       (IIJIMA Laboratory, Dept. of Science and Technology, Keio University).
   6 # ==============================================================================
   7 # ソフトウェア工学[02] 例題[02]-(009a)  Ex_02_009a_greatest_common_divisor_builtin.py
   8 # Ex(Example) 02-009a: 【組込関数】 最大公約数 gcd ( greatest common divisor )の使い方. 
   9 #                               Python 3.3から導入された.
  10 #        2018-10-03 飯島 正 (iijima@ae.keio.ac.jp)
  11 # ==============================================================================
  12 # ----- 数学関数を扱うためのmathモジュールをインポートする -----
  13 import math
  14 # ==============================================================================
  15 # ===== 【メイン・プログラム】  =====
  16 print( math.gcd( 350, 450 ) )
  17 # ==============================================================================


SoftEng: Python/Prog/Example/02/Ex_009a (last edited 2018-10-28 12:38:24 by TadashiIijima)