Lesson 9 of 23
break, continue மற்றும் Prime எண்கள்break, continue and Prime Numbers
9 min 25 XP
break loop-ஐ உடனே நிறுத்தும். continue அந்தச் சுற்றைத் தவிர்க்கும். Prime சோதனையில் ஒரு வகுத்தி கிடைத்தவுடன் break செய்யலாம்; √n வரை சோதித்தால் போதும்.
break stops a loop immediately; continue skips the rest of the current round. When testing for a prime, break as soon as you find a divisor, and you only need to check up to √n.
Example: edit me and press Run
Output Loading C (first time takes a few seconds)
Press Run to see the result here.