Questions tagged [subtraction]

Subtraction is a mathematical operation that represents the removal of an object from a collection.

Subtraction is a mathematical operation that represents the removal of an object from a collection. The minus sign (-) signifies subtraction.

Subtraction is anticommutative, meaning that changing the order changes the sign of the answer. It is not associative, meaning that when one subtracts more than two numbers, order in which subtraction is performed matters.

Basic Subtraction

You can imagine a number line that begins at position 3. If you subtract 2 from the starting position of 3, you will be left with 1.

3 - 2 = 1

3-2 number line

Source

1476 questions
-4
votes
2 answers

How I can reduce the length with each left click and right click each increase it?

Example: div.my{width: 100%;}
left click: div{width: 75%;} Right click: div{width: 100%;}
-4
votes
2 answers

subtractings arrays of ints in c++

I have two integer arrays of size 40. they are objects of the HugeInteger class. I need to subtract them. my code is HugeInteger HugeInteger::subtract(HugeInteger other) { int diff; HugeInteger result; for (int i=0; i
arisonu123
  • 339
  • 1
  • 3
  • 6
-4
votes
1 answer

SQL Join with subquery

Want to create a query that will join 3 tables together (a, b, c). Then update a specific cell in b.1, based on the subtraction of two specific cells in table b( b.2 - b.3). Any help would be appreciated.
-4
votes
1 answer

Regex subtract amount if the number is bigger than

I'm looking for a way to subtract a fixed amount if the number is bigger than specified value - using regex e.g. If the number is bigger than 10000 I want to subtract 5000, so it should look like: 175 -> 175 7831 -> 7831 12091 -> 7091
user2016412
  • 59
  • 1
  • 2
  • 5
-5
votes
3 answers

Python Real and imaginary : How to print -2-2i

Can you please help me with the below code where I am not getting the desired result: class comp: def __init__(self, real, imag): self.real=real self.imag=imag def add(self,other): print('Sum of the two Complex…
-5
votes
2 answers

Subtracting int from double leads to an error

I have an int and a double, but as soon as I try to subtract the integer from the double, the following error is thrown: Input string was not in a correct format. Now lets look at the code: double TotalNoRegis = values.Sum(); // This is a LIST and…
Maxi
  • 109
  • 1
  • 11
-5
votes
2 answers

How to subtract int Year(from user input) from DateTime.Now.Year?

I have a method Age() that returns the age of a car( subtracted from the year of production which is an int based on user input and it has to be an int). Also, from this method I raise an event that shows me the age of the car. I only need the…
-5
votes
3 answers

subtraction not working in java program (missing something)

I put together this program, my first one ever but after I enter the values in the boxes, the output in the end is "0" and not the subtraction. I don't know what i am missing. import java.util.Scanner; import javax.swing.JOptionPane; public class…
-5
votes
1 answer

Why wont this code allow me to subtract two lists in python?

I have two lists and want to subtract each element from its corresponding element in the opposite list. When I write this code: list(map(sub, irrad_fore, irrad_exp)) I get the following error: TypeError: unsupported operand type(s) for -:…
-5
votes
1 answer

Subtracting from a variable

I have code setup so that a player clicks an image which gets counted and if they have more than 30 it will allow them to buy an auto clicker for 30 clicks which then subtracts 30 clicks and sets c1 or your first buy option to 1 so you can only…
Segovo
  • 11
  • 1
-5
votes
1 answer

Subtracting loop elements

I want to subtract i from total in the for loop below: #include int main(int argc,const char *argv[]){ int total = 0; int i; for(i = 10; i > 0; i--){ // code } printf("Total: %d\n",total); return 0; } The…
-5
votes
1 answer

If my game has three lives, how do I subtract one life if the player gets an answer incorrect?

My game code is linked below. I have a static int at the top (above the main), called lives, it has a total of three. Later in my game, I want to make it so when the player gets a question wrong, it subtracts a life from the int variable. Is it…
-5
votes
4 answers

C++ simple math operations with floats and a wrong result?

I need simple math operations with some floats like "3.3 - 2.6". The result is 0.700001. I have no idea why there are numbers like 0.700001. Some examples Can you help me please?
Eric3235963
  • 1
  • 1
  • 5
-6
votes
1 answer
-6
votes
1 answer

MySQL arithmetic subtraction

I have a table like this: MYSQL table_01 tablo_02 Calculated tax Deductible tax -------------- --------------- 1200 2100 2305 5200 3250 1200 2501 3215 I want…
1 2 3
98
99