-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
addition,expression,subtraction in java
- Loading branch information
1 parent
71344ef
commit 4a1b4c9
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
public class Program | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
//divsion,addition,modulus,multiplication. | ||
int x=10; | ||
int y=15; | ||
int sum=x+y; | ||
int prd=x*y; | ||
int div1=x/y; | ||
int div2=y/x; | ||
int mod=y%x; | ||
System.out.println("Sum of "+x+" and "+y+" is "+sum); | ||
System.out.println("Product of "+x+" and "+y+" is "+prd); | ||
System.out.println("Division of "+x+" and "+y+" is "+div1); | ||
System.out.println("Division of "+y+" and "+x+" is "+div2); | ||
System.out.println("Modulus of "+y+" and "+x+" is "+mod); | ||
//expression | ||
int exp=x*y/x+y; | ||
//BODMAS applied system reads it as | ||
// exp=( x*(y/x) ) + y | ||
System.out.println("Expression value is " +exp); | ||
int exp1= (x*y)/(x+y); | ||
System.out.print("Expression2 value is " +exp1); | ||
|
||
} | ||
} |