I need help writing in IPO Chart and pseudocode for an assignment asking to "Write a program that prompts the user to input a positive integer. He should then output a message indicating whether the number is a prime number."
This is what I came up with for the IPO chart:

Positive integer Get user input Positive integer
Message (i,e. Prime number) Message
Positive integer Find the result based on integer entered Result
Positive integer, message, Result Display all Positive integer, message, Result

Recommended Answers

All 4 Replies

We don't do your homework for you. Try first and we can critique your efforts. Quick PS for this, to get you started.
1. Get input number.
2. If < 0 emit error and exit
3. If >= 0 see if is prime number.
4. If prime, huzza!
5. Else emit error and exit.

Note, that there is an error in my previous posting. It is your task to determine what it is... :-)


Note that I was NOT asking anybody to DO my homework for me. If you take the time to read my post thoroughly, you will notice that I showed what I had come up with thus far. It's just that I wasn't sure if I did was correct and needed somebody's constructive feedback.

I understood that, but your PS was so ambivalent that it is effectively useless. That is why I posted a sample for you. The purpose of pseudo-code is to express clearly what is to be done. That should be easily morphed into real code, depending upon the language you are going to program it in. After 30+ years of serious software development, I still use pseudo-code to help me clarify my intentions and designs. It helps tremendously to eliminate logic errors for the most part.

FWIW, I meant PC (pseudo-code) instead of PS in previous posts... Danged keyboard keeps mis-typing... :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.