Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* package whatever; // don't place package name! */
- import java.util.*;
- import java.lang.*;
- import java.io.*;
- /* Name of the class has to be "Main" only if the class is public. */
- class Example
- {
- public static void main (String[] args) throws java.lang.Exception
- {
- int x, y, z; // Assign "int" type too three variables "x, y, z".
- x = 100; // Assign value 100 to x.
- y = 210; // Assign value 210 to y.
- z = 0; // Assign value 0 to z.
- System.out.println("Solve for z when z = 0, x = 100, y = 210");
- x = y / 2; // Assign: Divide y where y is 210 by 2 where x is now 105.
- z = x + y; // Assign: Add x where x is 205 to y 105 where z is 305.
- System.out.print("The value of z where y/2 + x is " + z);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment