write a program in java to addition of two number
- import java.io.*;
- class Addition
- {
- public static void main(String args[])throws Exception
- {
- int a,b,c;
- BufferedReader br= new BufferedReader( new InputStreamReader(System.in));
- System.out.println("Enter the two numbers to add:");
- a=Integer.parseInt(br.readLine());
- b=Integer.parseInt(br.readLine());
- c = a+b;
- System.out.println("\nSum of two numbers:"+ c);
- }
- }
After run this program we will get output like this:
Output: |
---|
Enter the two numbers to add: |
2 |
3 |
Sum of two numbers:5 |
No comments:
Post a Comment