If we remove the num++ statement, the program would enter an infinite loop because the value of num would never change. It is essential to increment num to avoid infinite looping.