Write a function named isPrime

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

  1. The problem statement, all variables and given/known data:

Write a function named isPrime which accepts one integer parameter, say x. Have the function return TRUE if x is a prime. Otherwise, have it return FALSE.

b) Write a program that keeps asking the user for an integer say k. As long as k is greater than 0, the program will call isPrime to see if k is a prime. Print the message �Prime� if it is and �Not Prime� if not. Please run p4step1.exe in the class directory for details.

Step 2: a) Modify the above program so that the user will enter two integers say x and y. As long as y > x, the program will print all primes between x and y inclusive.

b) Write a function named findPrime which accepts two integer parameters say a and b. This function will print all prime numbers from a to b by calling the function isPrime. Have your program call this function using the user input x and y. Please run p4step2.exe for details.

c) In step a) your program should have two functions main and isPrime. In step b) there should be an additional function findPrime.

I know how to write like the first step and that's it.

  1. Relevant commands, code, scripts, algorithms:

  2.   You need to use the following functions:
    

a. (int) isPrime(int k),
b. (int) isPerfect( int k),
c. void findPrime(int x, int y);
d. void findPerfect(int x, int y);
e. void findSquare(int x, int y).
2. You need to use floor and ceil functions in <math.h> for finding the Square number.

  1. The attempts at a solution (include all code and scripts):

int _tmain(int argc, _TCHAR* argv[])
{ int x;
int k;
printf("Enter a positive integer -->", x);

return 0;
}

  1. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
    University of Delaware/Newark/US/HSU/CIS120

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

What language?
C ?

Yes sir. I'd love you forever.

I'm sorry I don't know C...
Just asked so everyone visiting the Thread knows. You havn't wrote anything about the language, what seemed important for a script to me :wink:

This is a common homework problem. You must show more effort than logging into a forum and asking others to write code for you.