Follow on Facebook

Like and Share on Facebook

Tuesday, March 10, 2015

Write a Program to Multiply of two Number Using User Input in Java


import java.io.*;

class Addition
{
public static void main(String arg[])throws IOException
{
int a,b,c;
InputStreamReader ir=new InputStreamReader(System.in);
BufferedReader br= new BufferedReader(ir);
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);
}
}
Output:
Enter the two numbers to Multiply:
2
3
Sum of two numbers:6

No comments:

Post a Comment