@shivam_bhalla
Pressure increases linearly with depth, the exact relation being P=pgh.
In this problem, the density is same and gravitational constant is also same. The only thing that varies the pressure down the wall is how deep we go.
From the figure, the wall is h units high and 2r units in width. At the top of the wall, the pressure is 0 (p*g*0) and at the bottom it is pgh. Since it increases linearly, we can use the average value of pressure that is pgh/2 as the pressure on the entire wall. The area of the wall is 2rh. So the force on the wall is (pgh/2)*(2rh), this is pressure times area.
Alternately, you can divide the wall into horizontal strips of height dh and length 2r. the force on a particular segment at a depth of h is 2rpghdh. You can find the total force by integrating this expression from 0 to H. I wouldn't recommend this though because it is a longer method. Remember in general that for a quantity changing linearly, you can use the average value to represent the quantity at any instance. We do this in constantly accelerated motion where u is initial velocity and v is final velocity. We can compute distance by (u+v)/2 * time.