Using C, Write a program that finds the 12th prime number (starting from 2). -Th
ID: 3641743 • Letter: U
Question
Using C, Write a program that finds the 12th prime number (starting from 2).-The main() must call a function.
-The function's name must by nPrime.
-nPrime() does not return a value using the return statement.
Note that a void function can call return; to terminate itself. So, a void function can call return; to give control back to the function that called it.
You may find useful to use the break statement as well.
-nPrime must not print anything. main() should do all the printing.
-You cannot use global variables.
-Use pointers to implement your program.
-nPrime must be generic enough to also return the 100th prime number or the 78th prime number, or the nth prime number.
Explanation / Answer
please rate #include #include /* * */ int n = 1; int primeN = 2; void nPrime(){ int i, j=2, primeCount=1,notPrime=0; if(primeCount>=n){ return; } for(i=3;;i++){ if(primeCount==n){ return; } j=2;notPrime=0; while(jRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.