Yêu cầu:
Viết chương trình nhập vào 2 số nguyên, sau đó in ra tổng bình phương của chúng.
Phân tích:
– Nhập vào 2 số nguyên từ bàn phím.
– Tính tổng theo công thức: S = a*a + b*b
test.py
""" # Author: VNCODING # Function: Sum of 2 square number # 2022/08/17 first create VNCODING """ print("Input integer a: ") a = input(); print("Input integer b: ") b = input(); s = int(a)*int(a) + int(b)*int(b) print("Sum of 2 square number: ", s)
Kết quả:
Input integer a:
4
Input integer b:
5
Sum of 2 square number: 41
Leave a Reply
You must be logged in to post a comment.