Question: C language Problem 1 Prime Numbers An integer is said to be prime number (or simply a prime) if it is divisible by only 1
Problem 1 Prime Numbers An integer is said to be prime number (or simply a prime) if it is divisible by only 1 and itself. For example: 2,3,5 and 7 are prime, but 4, 6, 8 and 9 are not. a) Write a function with prototype int isPrime (int n) that determines whether a number nis prime or not. b) Use this function in a program that prints out and counts all the prime numbers between 1 and 10,000 Problem 2 Recursive Exponentiation Write a recursive function power (base, exponent) that when invoked returns baseexponent. For example, power (3, 4) = 3 * 3 * 3 * 3. Assume that exponent is an integer greater than or equal to 1. Then, write a demo program that uses the power function and test it out for a number of inputs. Hint: The recursion step would use the relationship baseexponent = base * baseexponent-1 and the terminating condition occurs when exponent is equal to 1 because base; - base
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
