Page 1 of 1

Practice implementing functions Objectives Related knowledge A prime is positive integer that is greater than 1 and it i

Posted: Mon Jun 06, 2022 12:47 pm
by answerhappygod
Practice Implementing Functions Objectives Related Knowledge A Prime Is Positive Integer That Is Greater Than 1 And It I 1
Practice Implementing Functions Objectives Related Knowledge A Prime Is Positive Integer That Is Greater Than 1 And It I 1 (99.45 KiB) Viewed 51 times
C programming
Practice implementing functions Objectives Related knowledge A prime is positive integer that is greater than 1 and it is the multiple of 1 and itself only. Theorem: The integer n is a prime if and only if n>1 and it can not be divided by all integers from 2 to square root of n. Use the library math.h to get the function sqrt(double) for getting the square root of a positive number. Problem Write a C program that will: - permit user inputting a positive integer n, n>=2 print out primes between 2 and n Analysis Suggested algorithm (logical order of verbs) Nouns: positive integer Begin → int n Do { Accept n; } While (n<2); For (i=2 to n ) End If (i is a prime ) Print out i; // Function check prime