+ 5
Write a program to calculate sum of numbers from 1 to 100 without using loop statements.
You are free to choose any programming language. ======================= using only one statement, you have to print the sum of numbers from 1 to 100. Happy Coding!
4 Respuestas
+ 7
# given n = 100
print((1+n)*n/2)
+ 3
Jay Matthews’ code includes the solution I gave, and he answered first. I think his answer should be marked as best ☺️
+ 1
python:
lambda n: sum(range(n+1))
+ 1
num =100
print(num*(num+1)/2)