# Addition program

### Java code :

**Method - 1**

```java
public class Main{
    public static void main(String[] args){
        int a = 5;
        int b = 10;
        int c  = a + b;
        System.out.println("Addition of a and b is = " + c);
    }
}
```

**Explanation :**

**Step 1:** first we need to create the main method.

**Step 2:** then inside the main class we need to initialize `a, b, c` variables

Step 3: first we need to `give values` to the `a and b` value variables.

Step 4: we need to do the `sum` of a and b by using the `operator +`.

Step 5: After doing the `sum` we need to `store` the value in the `c variable` and `print` it to the screen using `the system. out.println()`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1671618398135/AGJcZGRGN.png align="left")

**Method 2:** **Without using a third variable.**

```java
public class Main{
    public static void main(String[] args){
        int a = 5;
        int b = 10;
        System.out.println("Addition of a and b is = " + (a+b));
    }
}
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1671618398135/AGJcZGRGN.png align="left")

### Python code:

```python
a = 10
b = 5
c  = a + b
print("Addition = " , c)
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1671618819870/hRbxT98vr.png align="left")

### C++ code:

```cpp
#include<iostream>
using namespace std;

int main(){
    int num1 = 5;
    int num2 = 10;
    int c = num1 + num2;
    cout << "Addition = " << c;
}
```

**Output:**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1671619429308/8uViK-jY_.png align="left")
