0
i=2; i<=num/2; ++i
Please explain this entire loop clearly step by step I am not understanding the condition statement this is the c++ number is prime or not program.
1 ответ
0
i is storing value which is 2.
i <= num / 2
This checks if i which is 2 is less than or is equal to the user given number divided by 2 .
++1
This part is for incrementing the value which is assigned 2 at first.
i = 2 will became 3
3 will be became 4 ...
2 <= 2 / 2
3 <= 2 / 2
4 <= 2 / 2...