A Day 3 Exercise In Learning Java
Today we are going to learn how to make java add up pre set numbers for you.
Using the template that I've shown you before set up the file and declare the int num and int num2 and result. Then give them a value here i gave each a value. Using both num and num2 we are going to give result the multiplicative value of them multiplied
Then after declaring it give it a value, for now use the ones i have provided in my file at the bottom. Using the shown bellow give result the num * num 2 number(don't solve it put what i did bellow)
Then make java execute result to see if it equals what it should equal 14 if not look for mistakes then post on here so i can help you.
int num;
int num2;
int result;
num = 7;
num2 = 2;
result = num * num2;(*for Multiply / for devide - for subtraction + for adding)
System.out.print("num times num2 equals: ");
System.out.println(result);
}
}
Thanks for some edits from rsgold4u
Last edited by jamesm201 : 03-02-2011 at 11:24 PM.
|