John spends 380 dollars to buy the following two items sugar and salt, the amount is 100 bags, a bag of sugar is 2 dollars, a bag of salt is 5 dollars, how much did John bought each of it?

I dunno how to write the equation and helps pls

let then number of sugar bags be x

then the number of salt bags is 100-x

now for the cost:
2x + 5(100-x) = 380
2x + 500 - 5x = 380
-3x = -120
x = 40

so he bought 40 bags of sugar and 60 bags of salt

or, using two variables

sugar bags --- x
salt bags ----- y

x + y = 100
2x + 5y = 380

multiply the first by 2
2x + 2y = 200
2x + 5y = 380
subtract them:
3x = 120
x = 40

sub back into the first
40+y = 100
y = 60

Thanks a lot bro

To find out how many bags of sugar and salt John bought, we can set up a system of equations.

Let's say John bought x bags of sugar and y bags of salt.

According to the given information, a bag of sugar costs $2, and a bag of salt costs $5. John spent a total of $380.

So, we can write the following equations:

1. The total number of bags: x + y = 100
2. The total amount spent: 2x + 5y = 380

We have two equations and two unknowns, which means we can solve this system of equations to find the values of x and y.

One way to solve this system of equations is by using the substitution method:

From the first equation, we can solve for x in terms of y by subtracting y from both sides:
x = 100 - y

Now we substitute the value of x in the second equation:
2(100 - y) + 5y = 380

Simplify the equation:
200 - 2y + 5y = 380
3y = 380 - 200
3y = 180
y = 180 / 3
y = 60

Now that we have the value of y, we can substitute it back into the first equation to find x:
x + 60 = 100
x = 100 - 60
x = 40

Therefore, John bought 40 bags of sugar and 60 bags of salt.