Calculation

HY2000

New member
Local time
Today, 00:24
Joined
Jun 27, 2018
Messages
8
Q: Determine the values (in integers) of a, b, and c of the following expressions,
I) a= 21+15%2*3;
II) b= (10-8)*5%2;
III) c= 17%(7%(8-4));

I have no idea how to calculate a,b,c value and show steps, I need some help:confused:

Thank you!!
 
BEDMAS ?

Brackets
Exponential
Division
Multiplication
Addition
Subtraction
 
I don't understand what the expressions mean due to the badly written use of %
For example, is that a = 21 + (0.15 * 2/3) = 21.1
 
HY2000 - if this is for a class, you are not helping yourself very well. The method to do these kinds of things SHOULD have been covered.

I agree with Colin (isladogs) that your #I expression is not written in standard format, in such a way as to be ambiguous. #II suffers from the same problem.

Here is a hint: IN GENERAL when you put two quantities side-by-side in common human notation, your intent is multiplication. Like if A and B are two variables, A B usually means A TIMES B, which in programming is A * B. Starting from there, perhaps you can proceed.

However, what is more confusing is "show your steps" because none of those problems requires any steps - unless you are seeking to program them in some type of Assembly language. In which case, you are VERY far afield. What is meant by "show your steps?"
 
% = modulus (the remainder of whole division)

5 % 3 = 2

I suggest you talk to your teacher or perhaps a fellow student. Honestly, this is first week Comp 101 stuff; its a month into classes---you might consider dropping the class.
 
BEDMAS ?

Brackets
Exponential
Division
Multiplication
Addition
Subtraction


:banghead:

What he said :D




This is the beginning and the end of your problem and it states the priority of operation in mathematics, and OF COURSE, programming


All of us at one time or another make mistakes and stumble somewhere, but most commonly it's either "BEDMAS" or missing syntax for closing statements


One other thing

You can never do too much brackets
 
You can never do too much brackets

Although if you have a complex query create in the query design grid and it has a couple of layers of alternate criteria, the SQL generator CAN do too many brackets.
 
Write queries directly without any support-wheels, therefore making sure you can only have less-than-enough brackets :D
 

Users who are viewing this thread

Back
Top Bottom