C Program To Find Prime Numbers From 2 To N, using While Loop

Pubblicato il: 18 gennaio 2020
sul canale di: Technotip
14,155
124

http://technotip.com/6939/c-program-t...

Lets write a C program to find and print / display all the prime numbers from 2 to N. Here N is the user entered number / limit.

Prime Number: Any natural number which is greater than 1 and has only two factors i.e., 1 and the number itself is called a prime number.

We apply square root to the user entered number and store it inside variable inum. This reduces the number of iterations of inner while loop.

So its enough if we iterate through the while loop sqrt(num) times to check if the user entered number is divisible by any number other than 1 and itself.

C Programming Interview / Viva Q&A List
http://technotip.com/6378/c-programmi...

C Programming: Beginner To Advance To Expert
http://technotip.com/6086/c-programmi...


In questa pagina del sito puoi guardare il video online C Program To Find Prime Numbers From 2 To N, using While Loop della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Technotip 18 gennaio 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 14,155 volte e gli è piaciuto 124 spettatori. Buona visione!