Question: Write a C program that prompts the user for two integers a and b, then output the prime numbers between the interval. Implement the following
Write a C program that prompts the user for two integers a and b, then output the prime numbers between the interval. Implement the following function for this computation. 1 void primeInterval(int a, int b); The printing should be done in the primeInterval function and not in the main function. A Hint for Determining a Prime Number: An integer is prime if it is only divisible by 1 and itself. Consider the following algorithm to determine if an integer x is prime: for each integer y from 2 up to the square root of x, if y divides x, then x is composite (not prime). Otherwise if no such integer in that range divides x, then x is prime.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
