All triangle between q and p are acute triangles . So add q - p in z .
z += q - p ; } } } System . out . println ( " Acute ▁ Triangle : ▁ " + x ) ; System . out . println ( " Right ▁ Triangle : ▁ " + y ) ; System . out . println ( " Obtuse ▁ Triangle : ▁ " + z ) ; }