from tkinter import *

root = Tk()
root.geometry("400x300")
root.title("Обчислення суми чисел")
.



x_label = Label(root, text="Введіть перше число:")
x_label.pack()
x_entry = Entry(root)
x_entry.pack()

n_label = Label(root, text="Введіть кількість чисел:")
n_label.pack()
n_entry = Entry(root)
n_entry.pack()


def calculate_sum():
x = int(x_entry.get())
n = int(n_entry.get())
s = 0
for i in range(n):
s += x
x += 20
result_label.config(text="Сума чисел дорівнює: " + str(s))

calculate_button = Button(root, text="Обчислити суму", command=calculate_sum)
calculate_button.pack()


result_label = Label(root)
result_label.pack()

root.mainloop()
Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Copyright © 2025 SCHOLAR.TIPS - All rights reserved.