Lets call x to the number of ducks
and y the number of pigs.
Then:
[tex]2x+4y=98[/tex]Because there are 2 legs per duck and 4 legs per pig.
If the total of animals is 37, then:
[tex]x+y=37[/tex]Then:
[tex]x=37-y[/tex]And replacing on the first equation we get:
[tex]2(37-y)+4y=98[/tex][tex]74-2y+4y=98[/tex][tex]2y=98-74[/tex][tex]2y=24[/tex][tex]y=\frac{24}{2}[/tex][tex]y=12[/tex]There are 12 pigs and therefore 25 ducks.