We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Since this problem is still at the basic stage (no loops, macros, or conditionals introduced yet), I thought I'd share a solution that sticks to the fundamentals: just functions and some simple math.
I’ve seen many solutions here that use macros or ternary operators, which are definitely efficient, but I wanted to explore if we can solve it differently.
Functions in C
You are viewing a single comment's thread. Return to all comments →
Since this problem is still at the basic stage (no loops, macros, or conditionals introduced yet), I thought I'd share a solution that sticks to the fundamentals: just functions and some simple math.
I’ve seen many solutions here that use macros or ternary operators, which are definitely efficient, but I wanted to explore if we can solve it differently.