Body centred cubic unit cell: This type of unit cell has eight atoms at commen and one at the body centre. Each corner atom makes 1/8 contribution and the atom at the body centre belongs only to the particular unit cell.
Hence, a body centred unit cell has 8 (at the corner) x 1/8 + 1 (at body centre) x 1 = 2 atoms.
Face centred cubic unit cell : A face centred cubic unit cell has one atom at each corner (there are eight corners of a cube) and one atom at each face centre (there are six faces of a cube). An atom at the face centre is being shared by two unit cells and make a contribution of only 1/2 to a particular unit cell.
Hence, a face centred cubic unit cell has 8 (at corners) x 1/8 + 6 (at face centre) x 1/2 = 4 atoms.