Skip to content

Instantly share code, notes, and snippets.

@maipatana
Last active May 1, 2017 15:50
Show Gist options
  • Save maipatana/7cd9753d68e5a0f4d379e208103c6436 to your computer and use it in GitHub Desktop.
Save maipatana/7cd9753d68e5a0f4d379e208103c6436 to your computer and use it in GitHub Desktop.
ให้ดูความง่ายของการเขียนโปรแกรมคำนวน "ปริมาตรคอนกรีต" คร่าวๆกันไปก่อน จะมาอธิบายแต่ละส่วน ใครมี python ในเครื่องก็ลองทดสอบดู
def volume_cal(height,width,long):
cal = (height/1000) * (width/1000) * (long/1000)
return cal
while True:
print('\nเมนู \n 1.คำนวนปริมาตร \n 2.ออกจากโปรแกรม')
choice = input('ป้อนหัวข้อที่ต้องการคำนวณ : ')
if int(choice) == 1:
a = int(input('ป้อน Depth (mm): '))
b = int(input('ป้อน Width (mm): '))
c = int(input('ป้อน long (mm): '))
y = volume_cal(a,b,c)
print("-------------------------------")
print ("ปริมาตรคอนกรีตคาน ",round(y,2)," ลูกบาศก์เมตร")
print("-------------------------------")
elif int(choice) == 2:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment