0

How to print prime numbers between 1-100 using continue statement?

9th Oct 2018, 8:52 AM
Jeeva Gva
Jeeva Gva - avatar
2 Respuestas
+ 3
The continue statement: The continue statement is used inside loops. When a continue statement is encountered inside a loop, control jumps to the beginning of the loop for next iteration, skipping the execution of statements inside the body of loop for the current iteration. https://beginnersbook.com/2014/01/c-continue-statement/ Pseudo code for detecting if the number is a prime: function is_prime(n) if n ≤ 1 return false else if n ≤ 3 return true else if n mod 2 = 0 or n mod 3 = 0 return false let i ← 5 while i * i ≤ n if n mod i = 0 or n mod (i + 2) = 0 return false i ← i + 6 return true https://en.wikipedia.org/wiki/Primality_test And maybe this stackoverflow question will help you: https://stackoverflow.com/questions/41444655/prime-numbers-between-1-to-100-in-c-programming-language
9th Oct 2018, 9:10 AM
Willem Roos
0
thks bro
9th Oct 2018, 9:11 AM
Jeeva Gva
Jeeva Gva - avatar