@lakshayarora7/# WhiteShimmeringHuia

Files

- main.py

main.py

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

```
##
## Calculate the sum of first n integers
# Get input from user
n = int(input("Enter the value of n: "))
# Calculating the sum upto the provided number
summation = ( n * (n + 1) ) / 2
# Outputting the value on to the screen
print("Sum of first", str(n), "integers is:", int(summation))
## INPUT: 5 OUTPUT: 15
## summation variable becomes a float when there is a dividing operation in the expression. That is why, we cast the value of summation to an int in the print statement.
##
```