Type the programs in NOTEPAD or DOS prompt itself, for Consol Application.
Type in NETBEANS or ECLIPSE for Window Application.
Here after , I am just typing the programs only..to know more about it , refer
Type in NETBEANS or ECLIPSE for Window Application.
Here after , I am just typing the programs only..to know more about it , refer
Introduction to JAVA
before doing any JAVA Programs.
***********************************************************************************************
import java.io.*;
class math
{
public static void main(String args[])
{
int a,b,result;
try
{
DataInputStream x=new DataInputStream(System.in);
System.out.println("Enter the first number :");
a=Integer.parseInt(x.readLine());
System.out.println("Enter the second number :");
b=Integer.parseInt(x.readLine());
result=a+b;
System.out.println("Addition = "+result);
result=a-b;
System.out.println("Subtraction = "+result);
result=a*b;
System.out.println("Multiplication = "+result);
result=a/b;
System.out.println("Division = "+result);
}
catch(Exception e)
{
}
}
}
=========================================================================
Output :
Enter the first number
8
Enter the second number
4
Addition=12
Subtraction =4
Multiplication =32
No comments:
Post a Comment