Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Saturday, July 28, 2012

CJ-5 : Four Calculations-Integer no

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

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
Division=2


Refer Four Calculations-Floating no also.







No comments: