Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- i = int(input("Enter n:"))
- count = 1
- total = 0
- result = ""
- while count <= i:
- total += count
- if count < i:
- result += str(count) + "+"
- else:
- result += str(count) + "="
- count += 1
- print(f"{result}{total}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement