Open krujeen opened 3 years ago
จงหา ห.ร.ม.ของเลขจำนวนเต็มบวก 2 จำนวน
โดย ข้อมูลนำเข้า เป็นตัวเลขสองจำนวน ข้อมูลออก เป็น ห.ร.ม. ของตัวเลขสองจำนวนนั้น
ตัวอย่างการทำงาน 1 input
18 24
output
6
ตัวอย่างการทำงาน 2 input
48 180
12
import math a = int(input()) b = int(input()) if (b>a) : c = b b = a a = c while(a%b!=0): c = a%b a = b b = c print(b)
จงหา ห.ร.ม.ของเลขจำนวนเต็มบวก 2 จำนวน
โดย ข้อมูลนำเข้า เป็นตัวเลขสองจำนวน ข้อมูลออก เป็น ห.ร.ม. ของตัวเลขสองจำนวนนั้น
ตัวอย่างการทำงาน 1 input
output
ตัวอย่างการทำงาน 2 input
output