Anyone wanna write this?


 
Thread Tools Search this Thread
Top Forums Programming Anyone wanna write this?
# 1  
Old 10-25-2010
Question Anyone wanna write this?

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.
# 2  
Old 10-25-2010
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

Wanna change my username

Hi team, I want to change my username.. I tried in the edit option but i can't get it.. Can u help me.? (1 Reply)
Discussion started by: Adhi
1 Replies

2. Shell Programming and Scripting

Need Bits - Anyone wanna work something out?

I need bits for the emergency forum....my panic levels are starting to rise due to no responses to my threads. Please let me know if you have extra bits, and what it will take to get them. I need like 13000 more to post in there I think. Thank you, D ---------- Post updated at 01:09 PM... (0 Replies)
Discussion started by: tekster2
0 Replies

3. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

4. Linux

I am a beginner.Wanna become expert.

Hi Everybody, I am beginner to Unix platform, Can anybody guide me to learn the Unix, Scripting, shell scripting and inside stuff. I am interesting in programming that needs the step by step walk. Thankful to those who dare to walk along. yours farooq (5 Replies)
Discussion started by: farooq_kdp
5 Replies

5. Shell Programming and Scripting

wanna contribute to gnu

I want to contribute to any project that currently going on in the gnu. What is the procedure. (1 Reply)
Discussion started by: yogesh_powar
1 Replies

6. UNIX for Dummies Questions & Answers

total windows cripple wanna learn unix well

hello, I finally installed a unix port (NetBSD) on my workpad z50 and now I'm trying to configure it and well right about now I know 2 commands and I can start one program Vi is the program and I can navagate with cd and ls those are the two commands wait I know 3 date I also know but I can't even... (3 Replies)
Discussion started by: terramir
3 Replies

7. Shell Programming and Scripting

New to it all, But i wanna script really badly!!!

Ok, im brand new to this whole thing, well nearly, but all i wanna know and do is scripting, WHAT DO I DO?!:confused: (3 Replies)
Discussion started by: TheNewGuy
3 Replies
Login or Register to Ask a Question