Here is code in Python.
# variable to store sum of numbers from 1 to 10
sum=0
for i in range(1,11):
#calculating the sum
sum+=i
#printing the sum
print("sum of numbers from 1 to 10 is:")
print(sum)
Step-by-step explanation:
Declare a variable "sum" to store the sum of all the numbers from 1 to 10.
In the for loop i will iterate from 1 to 10 only and each value of i is added to
"sum". then it will print the sum of all the number.
Output:
sum of numbers from 1 to 10 is:
55