วันศุกร์ที่ 30 มกราคม พ.ศ. 2558

บวกลบ.py

#!/usr/bin/python
#-*-coding: utf-8 -*-
print ("Program + or -")
print ("Build by Wannaphong")
print ("18/10/2013")
print ("1.+  2. -")
x = int(input("input: "))
if x == 1:
    a = int(input("input1: "))
    b = int(input("input2: "))
    print ("=" , a + b)
elif x == 2:
    c = int(input("input1: "))
    d = int(input("input2: "))
    print ("=" , c - d)
elif x < 1 or x > 2:
    print ("No!. You input'n 1 or 2.")

ไม่มีความคิดเห็น:

แสดงความคิดเห็น