calculating using variables java

Questions/Tutorials for any programming language not covered in other sections.
1 post Page 1 of 1
Contributors
User avatar
Shim
VIP - Donator
VIP - Donator
Posts: 882
Joined: Wed Dec 14, 2011 5:02 am

calculating using variables java
Shim
hey guys

this small snippet will help you understand how to calculate using variables ok now
Code: Select all
class variables
{
  public static void main(String args[])
  {
    int x=11;
    int y=100;
    int z;
	
	z = x+y;
   
    System.out.println("The Answer Is : " + z);
  }
  
}
integer x value is equal to 11 and integer y value is equal to 100 and z value is x and y that mean z will get the total of x and y

proof

Image

you can also use multiply and divide etc instead of addition :ugeek: now you can do calculations using variables in java cooll;
Find my programs on Softpedia
1 post Page 1 of 1
Return to “Misc”