This is my function for finding prime numbers
void print(int num)
{
for(int i=2; i
Yes, the loop runs n/2-1 times and only contains commands of constant complexity, so your runtime scales as a*(n/2-1) for some a. In big-o this is written as O(n/2-1) and because constant factors don't matter this is equal to O(n).
(as an aside: it is actually theta(n) which means, that it is not just bounded from above by n but also from below by n)