ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [1000๋ฒˆ] A+B
    SW/BAEKJOON(online judge) 2023. 6. 7. 13:53

     

     ๋‘ ์ •์ˆ˜ A์™€ B๋ฅผ ์ž…๋ ฅ๋ฐ›์€ ๋‹ค์Œ, A+B๋ฅผ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•ด๋ณด๋ฉด, 

     

      A = int(input("์ฒซ ๋ฒˆ์งธ ์ •์ˆ˜๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”: "))
      B = int(input("๋‘ ๋ฒˆ์งธ ์ •์ˆ˜๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”: "))

      result = A + B
      print("A์™€ B์˜ ํ•ฉ์€", result, "์ž…๋‹ˆ๋‹ค.")

     

     ์ด ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜๋ฉด ์‚ฌ์šฉ์ž๋กœ๋ถ€ํ„ฐ ๋‘ ๊ฐœ์˜ ์ •์ˆ˜๋ฅผ ์ž…๋ ฅ๋ฐ›๊ณ , ๊ทธ ๋‘ ์ •์ˆ˜์˜ ํ•ฉ์„ ์ถœ๋ ฅํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

     ํ•˜์ง€๋งŒ ๋ฐฑ์ค€์‚ฌ์ดํŠธ์— ์ž…๋ ฅํ•ด๋ณด๋ฉด ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ๊ทธ ์ด์œ ๋Š” ์‹ค์ œ ๋ฌธ์ œ์—์„  ํ•œ ์ค„์—์„œ 2๊ฐœ์˜ ์ˆ˜๋ฅผ ์ž…๋ ฅ๋ฐ›๊ณ  ์žˆ๊ณ , ๊ทธ ๊ฒฐ๊ณผ ๊ฐ’์ธ ์ˆซ์ž๋งŒ ์ถœ๋ ฅํ•˜๋ฉด ๋˜๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.

     

    a, b = map(int, input().split())
    print(a+b)

     ์œ„์™€ ๊ฐ™์€ ์ฝ”๋“œ๋กœ ๋ณ€ํ˜•ํ•˜์—ฌ ์ œ์ถœํ–ˆ์„ ๋•Œ ์ •๋‹ต์œผ๋กœ ์ธ์ •๋ฉ๋‹ˆ๋‹ค.

    'SW > BAEKJOON(online judge)' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

    [1002๋ฒˆ] ํ„ฐ๋ ›  (0) 2023.06.07
    [1001๋ฒˆ] A-B  (0) 2023.06.07

    ๋Œ“๊ธ€

Designed by Tistory.