SIMPLE JAVA PROGRAM FO ADDITION OF TWO NUMBERS
USING 3 VARIABLES
import java.lang.*;
class add
{
public static void main(String args[])
{
int a=10,b=20,temp;// HERE A,B,TEMP IS VARIABLES
temp=a+b;//TEMP VARIABLE STORES ADDITION OF A,B
System.out.println("temp="+temp);
}
}
OUT PUT:-
temp=30
USING 3 VARIABLES
import java.lang.*;
class add
{
public static void main(String args[])
{
int a=10,b=20,temp;// HERE A,B,TEMP IS VARIABLES
temp=a+b;//TEMP VARIABLE STORES ADDITION OF A,B
System.out.println("temp="+temp);
}
}
OUT PUT:-
temp=30
No comments:
Post a Comment