C++20 sections · 1024 units
Open in Course

Problem - Young Physicist

Force equilibrium check

You're given nn force vectors in 3D space. Each force has three components: xx, yy, and zz. A system is in equilibrium when the sum of all forces equals zero in all three directions.

Your task: determine if the forces balance out. If the sum of all xx components is zero, AND all yy components sum to zero, AND all zz components sum to zero, output YES. Otherwise, output NO.

Before reading further, think: how would you model a 3D vector in code? What data does each vector need? How do you add vectors together?