Lesson 9 of 23

break, continue ಮತ್ತು Prime ಸಂಖ್ಯೆಗಳು

9 min 25 XP

break loop ಅನ್ನು ತಕ್ಷಣ ನಿಲ್ಲಿಸುತ್ತದೆ; continue ಪ್ರಸ್ತುತ round ನ ಉಳಿದ ಭಾಗ ಬಿಡುತ್ತದೆ. Prime ಪರೀಕ್ಷಿಸುವಾಗ ಭಾಜಕ ಸಿಕ್ಕ ತಕ್ಷಣ break ಮಾಡಿ, √n ವರೆಗೆ ಮಾತ್ರ ಪರಿಶೀಲಿಸಿದರೆ ಸಾಕು.

Example: edit me and press Run

Output Loading C (first time takes a few seconds)
Press Run to see the result here.

Challenge

+25 XP

a ಮತ್ತು b ಓದಿ a ಯಿಂದ b ವರೆಗೆ (ಎರಡೂ ಸೇರಿ) ಎಷ್ಟು primes ಇವೆ ಎಂದು print ಮಾಡಿ. Input: 10 30 → Output: 6

Output Loading C (first time takes a few seconds)
Press Run to see the result here.