I'll go the other way and presume that 25 and 40 are the chainwheel sizes just for the hell of it.
Please excuse me going into the following explanation but given the query, I'm also presuming it is not known.
I've always used "gear inches" to express gears and because of that, gears expressed as gear inches mean something to me more than actual ratios as per
@cougie uk 's post*. There's plenty of people who use gear inches and certainly in my experience, it's the most common and understood way to talk about bike gears.
A ratio tells you how many times the wheels go round per single revolution of the pedals (or the other way round?) so a ratio of 1 (or 1:1) means one turn of the pedals = one turn of the wheels. So how far you travel per revolution with a gear ratio of "1" depends on the size of the wheel - you will travel the circumference of the wheel and so a gear ratio of "1" on a 20" wheeled bike will be considerably lower gear than on a 29" wheeled bike. Although both have a ratio of 1:1, the 20" wheeled bike has a gear of 20" (gear inches) and the 29" bike has a gear of 29" (gear inches). To be more accurate, the gear inch will be the diameter of the wheel including tyres and be affected by pressure and load - so to accurately work out the gear inch, the best way is to measure the distance travelled over one wheel revolution whilst sat on the bike and factor that in.
Luckily, there are plenty of tables and calculators (online ones are very good) that take the hard work out of the maths, so I will just use my favourite online calculator.
Presuming a wheel circumference of 2170mm, the 25T front/30T rear gives a gear of 23.2" and the 42 front/40 rear gives a gear of 28.6".
Here's the
online calculator that I used - as well as reading in gear inches, you can change it to ratios, speed, development etc. and you can change the pedal cadence to see changes in speed. I've set it up in that link for the two examples asked in the OP but you can enter multiple sprockets and chainrings, for example, here's
my folding bike (7 speed) compared with my touring bike (3x9) gearing.
* Edit: I've just re-read cougie UK's post and see that he has given the formula for gear inches
not the simple ratio that I had based my comment on - sorry cougie.