250,790 views
4 votes
4 votes
We have removed

A
balls from a box that contained
N
balls and then put
B
new balls into that box. How many balls does the box contain now?
Constraints
All values in input are integers.
Input
Input is given from Standard Input in the following format: n a b
Output
Print the answer as an integer.

User Jacobo Polavieja
by
2.9k points

1 Answer

22 votes
22 votes

There were
N balls but we took
A balls out, so there are now
N-A balls. We add
B balls and now we have
N-A+B balls.

The program that computes this (I will use python as language has not been specified is the following):

n, a, b = int(input()), int(input()), int(input())

print(f"There are {n-a+b} balls in the box")

# Hope this helps

User DragoJokera
by
2.8k points