- //Sum of two numbers without using third variable
- import java.io.*;
- class Addition3
- {
- public static void main(String args[])throws Exception
- {
- int a = 5 , b = 6;
- a= a+b;
- System.out.println("\nSum of two numbers:"+ a);
- }
- }
Output: |
---|
Sum of two numbers:11 |