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:51 AM
Dipanjan Basu
Dipanjan Basu - avatar
1 Answer
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...
26th Sep 2019, 1:22 PM
★«D.Connect_Zone»
★«D.Connect_Zone» - avatar