Damage = ((((2 Level / 5 + 2) AttackStat AttackPower / DefenseStat) / 50) + 2) STAB Weakness/Resistance RandomNumber / 100
Not very effective (4x) = x.25
Not very effective (2x) = x.5
Neutral = x1
Super effective (x2) = x2
Super effective (x4) = x4
Of course, the attack power and defense depends on the type of move being used (Special or Physical).
So, if a Pokemon used tackle on an Aggron, it would be a *4 resistance because both rock and steel types resist normal. Simple enough? Next, RandomNumber is just a random number between 85 and 100, and is what makes each hit do a different amount of damage. And 100 is another set number.
Source:http://pokemondb.net/pokebase/149687/how-is-damage-calculated