Created
January 5, 2026 13:16
-
-
Save kms0219kms/bc584cfbbdf62bed8854331c0f38975d to your computer and use it in GitHub Desktop.
2025-2026 오성고_공동교육_정보과학 Day 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def main(): | |
| n = int(input("숫자를 입력하세요: ")) | |
| total = 0 | |
| for i in range(1, n + 1): | |
| total += i | |
| print("합계:", total) | |
| if __name__ == "__main__": | |
| main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def main(): | |
| n = int(input("숫자를 입력하세요: ")) | |
| total = 0 | |
| i = 1 | |
| while i <= n: | |
| total += i | |
| i += 1 | |
| print("합계:", total) | |
| if __name__ == "__main__": | |
| main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def main(): | |
| n = int(input("숫자를 입력하세요: ")) | |
| total = n * (n + 1) // 2 | |
| print("합계:", total) | |
| if __name__ == "__main__": | |
| main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def main(): | |
| n = int(input("숫자를 입력하세요: ")) | |
| total = sum(range(1, n + 1)) | |
| print("합계:", total) | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment