C++ and Mathematics
Basic C++ through mathematical problems, the way it is taught to mathematicians: sums and loops, recursion, the Euclidean algorithm and primes, arrays and progressions, Newton's method and numerical integration. In the exercises you read code and work out what it prints โ the best way to build algorithmic thinking.

Your path to the summit starts here. First topic โ Variables, types and arithmetic.
Roadmap
Study the topics in this order. Each one builds on the previous.
- Step 1 45 min8 questions
Variables, types and arithmetic
Structure of a C++ program, int and double, integer division and remainder, operator precedence, type conversion.
intvsdouble- Integer division
/and remainder% - The
++and+=operators - Type conversion
0 of 8 solved - Step 2 50 min8 questions
Conditions and loops
if/else, logical operators,forandwhileloops, sums and products in code, nested loops.- Computing a sum with a loop
- Counting with a condition
whileloops- Counting iterations of nested loops
0 of 8 solved - Step 3 55 min8 questions
Functions and recursion
Defining and calling functions, pass by value vs by reference, recursion: factorial, Fibonacci, fast power, digit sum.
- Function composition
int xvsint &x- Base case and recursive step
- Fast exponentiation
0 of 8 solved - Step 4 60 min8 questions
Number theory in code
The Euclidean algorithm, GCD and LCM, primes, divisors, digits and modular arithmetic.
- The Euclidean algorithm
- Primality test up to
- Sum of divisors
- Remainders of powers
0 of 8 solved - Step 5 50 min8 questions
Arrays, vectors and sequences
Arrays and
vector, zero-based indexing, sum, maximum, prefix sums, progressions, sorting.- Zero-based indexing
- Finding the maximum
- Prefix sums
sortand sequences
0 of 8 solved - Step 6 60 min8 questions
Numerical methods
Floating-point precision,
<cmath>, Newton's method, bisection, numerical integration and series approximations.- Comparing
doubles with a tolerance - Newton's method for
- The bisection method
- Trapezoidal rule and approximating
0 of 8 solved - Comparing
