This program is for printing prime numbers till the input given and separating every prime number with a comma.
void main(){ int N, counter=0, isPrime;
To easily remove the last comma you can use the '\b' character.
'\b'
for(auto item : vec) std::cout << item << ", " ; std::cout << "\b\b " << std::endl;