Check if the given vectors are at equilibrium or not | Function to check the equilibrium of three vectors ; Summing the x coordinates ; Summing the y coordinates ; Summing the z coordinates ; Checking the condition for equilibrium ; Driver Code ; Checking for equilibrium
function checkEquilibrium ( x1 , y1 , z1 , x2 , y2 , z2 , x3 , y3 , z3 ) { var resx = x1 + x2 + x3 ; var resy = y1 + y2 + y3 ; var resz = z1 + z2 + z3 ; if ( resx == 0 & resy == 0 & resz == 0 ) return true ; else return false ; } var x1 = - 2 , y1 = - 7 , z1 = - 9 , x2 = 5 , y2 = - 14 , z2 = 14 , x3 = - 3 , y3 = 21 , z3 = - 5 ; if ( checkEquilibrium ( x1 , y1 , z1 , x2 , y2 , z2 , x3 , y3 , z3 ) ) document . write ( " " ) ; else document . write ( " " ) ;