Follow on Facebook

Like and Share on Facebook

Tuesday, February 10, 2015

Sum of Two Numbers in Java Using Input Stream Reader



import java.io.*;

class sum
{
public static void main (String args[]) throws IOException
{
int a , b ,c ;
InputStreamReader ir=new InputStreamReader(System.in);
BufferedReader br =new BufferedReader(ir);
System.out.println("Please Enter the Value of First Number");
a=Integer.parseInt(br.readLine());
System.out.println("Please Enter the Value of Second Number");
b=Integer.parseInt(br.readLine());
c=a+b;
System.out.println("Sum of the Givin Number is =" +c);
}
}

--------------------Output--------------------

Please Enter the Value of First Number
34
Please Enter the Value of Second Number
45
Sum of the Givin Number is =79


Process completed.

No comments:

Post a Comment