Hi guys,
I am pretty new to java, and I have to write out an algorithm for a few operations following each other. The point I am at, is adding two numbers and then dividing the product. This is the code I have come up with so far, excuse the incoherence of it.
public class AddNumbers{
public static void main(String[] args) {
System.out.println("Addition of two numbers!");
int a = Integer.parseInt(args[15]);
int b = Integer.parseInt(args[7]);
int sum = a + b;
System.out.println("Sum: " + sum);}
{int k = sum;
int j = 30;
int i = k/j ;
}}
I am confused about how to link the sum to the division operation following it... I tried writing instead of int sum = a + b; this : int sum = k = a+b; in order to use the variable k to do int i = k/j; but it does not work. I just need help with how to link these operations, i have a few more to do after, so understanding this would be an important part of continuing the algorithm.
Thanks guys