Program to sum two numbers.

import java.io.*;
class Sum
{
public static void main(String[] arg)throws IOException
{
BufferedReader in= new BufferedReader(new InputStreamReader(System.in));
int n1,n2,sum=0;
String num;
System.out.println("Enter the first number::");
num= in.readLine();
n1= Integer.parseInt(num);
System.out.println("Enter the second number::");
num=in.readLine();
n2=Integer.parseInt(num);
sum=n1+n2;
System.out.println("SUM="+sum);
}
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s