# Addition of number using for loop and providing user input data in python

Contents

## Addition of Number using for loop

In this program addition of numbers using for loop, we will take the user input value and we will take a range from 1 to input_num + 1. Using for loop, we will sum all the values.

`num=int(input("enter number:"))total=0for i in range(1,num+1):    total+=i    i+=1print("total sum is:",total)`

## Sum of all input number in Python

`n=input("enter number: ").split(',')total=0for i in range(len(n)):    total+=int(n[i])    i+=1print(total)`

### Output:

`C:\Users\Pramod\PycharmProjects\pythonProject\venv\Scripts\python.exe C:/Users/Pramod/PycharmProjects/pythonProject/main.pyenter number: 1,2,3,4,515Process finished with exit code 0`

## A simple way for Addition by using def in Python

`def add():    return "sum of these two number is:",11+99print(add())`

### Output:

`C:\Users\Pramod\PycharmProjects\pythonProject\venv\Scripts\python.exe C:/Users/Pramod/PycharmProjects/pythonProject/main.pyenter number: saa('sum of these two number is:', 110)Process finished with exit code 0`