#include <cmath>
#include <iostream>

bool isPrime(int num)
{
    // If your function is only executed from that loop above, delete this statement.
    if(num < 2)
        // Technically speaking this should be false. (I don't know if your code requires these numbers to be true.)
        return true;

    if(!(num % 2))
        return false;

    int sqrt_n = sqrt(num); // changed varaible name, it conflicted with sqrt()
    for (int i=3; i<sqrt_n; i += 2)
        if (!(num % i))
            // You can stop after you found the first divisor
            return false;

    return true;
}

int main() {
	for (int i = 0; i < 100; ++i) {
		if (isPrime(i)) {
			std::cout << i << ' ';
		}
	}
	std::cout << '\n';
}
