i=2; i<=num/2; ++i | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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.

25th Sep 2019, 7:52 AM
Dipanjan Basu
Dipanjan Basu - avatar
1 Answer
0
Variable <i> here is a loop counter. The loop counter is initialized as 2, and the value of variable <i> will be incremented by one on each loop iteration until value of <i> equals <num> / 2. Try to review the lesson on loops, usually it helps.
25th Sep 2019, 8:31 AM
Ipang