C++20 sections · 1024 units
Open in Course

Problem - Young Physicist

Checking force balance

You have nn force vectors in 3D space, each with coordinates (x,y,z)(x, y, z). Your task: determine if they're in equilibrium, meaning their sum is the zero vector (0,0,0)(0, 0, 0). Output YES if balanced, NO otherwise.

This teaches you to work with multi-dimensional data and write functions that return boolean values. You'll sum vectors component-wise and check a condition, perfect for practicing function design.

Think about this before reading on: if you have forces (1,0,0)(1, 0, 0), (1,2,0)(-1, 2, 0), and (0,2,0)(0, -2, 0), are they balanced? What does balanced mean mathematically?