โ ๋ ์ซ์์ ํฉ๊ณ ๋ฐ๋ณต ๊ณ์ฐ (Ctrl + C ๋๋ฅผ๋๊น์ง ๋ฐ๋ณต)
sum =0
a,b = 0,0
while (True) :
a = int(input("์ฒซ๋ฒ์งธ ์ซ์"))
b = int(input("๋๋ฒ์งธ ์ซ์"))
sum = a+b
print ("a+b ํฉ๊ณ : %d" % sum);
โ ๋ ์ซ์์ +-*/ (Ctrl + C ๋๋ฅผ๋๊น์ง ๋ฐ๋ณต)
sum =0
a,b = 0,0
ch=""
while (True) :
a = int(input("์ฒซ๋ฒ์งธ ์ซ์ : "))
b = int(input("๋๋ฒ์งธ ์ซ์ : "))
ch = input("์ฐ์ฐ์ ์
๋ ฅ : ")
if (ch == "+") :
print ("a+b : %d" % (a+b));
elif (ch == "-") :
print ("a-b : %d" % (a-b));
elif (ch == "*") :
print ("a*b : %d" % (a*b));
elif (ch == "/") :
print ("a/b : %d" % (a/b));
elif (ch == "%") :
print ("a%b : %d" % (a%b));
elif (ch == "//") :
print ("a//b : %d" % (a//b));
elif (ch == "**") :
print ("a**b : %d" % (a**b));
else :
print ("์ฐ์ฐ์ ์๋ชป ์
๋ ฅ")
โ break ๋ฌธ ์ถ๊ฐ
sum =0
a,b = 0,0
ch=""
while (True) :
a = int(input("์ฒซ๋ฒ์งธ ์ซ์ : "))
b = int(input("๋๋ฒ์งธ ์ซ์ : "))
ch = input("์ฐ์ฐ์ ์
๋ ฅ : ")
if (ch == "+") :
print ("a+b : %d" % (a+b));
elif (ch == "-") :
print ("a-b : %d" % (a-b));
elif (ch == "*") :
print ("a*b : %d" % (a*b));
elif (ch == "/") :
print ("a/b : %d" % (a/b));
elif (ch == "%") :
print ("a%b : %d" % (a%b));
elif (ch == "//") :
print ("a//b : %d" % (a//b));
elif (ch == "**") :
print ("a**b : %d" % (a**b));
elif (ch == "$") :
break;
else :
print ("์ฐ์ฐ์ ์๋ชป ์
๋ ฅ")
print ("๋")