This preview shows page 1. Sign up to view the full content.
Unformatted text preview: e divisor2 < userNumber if userNumber % divisor is equal to 0 write "The number is not prime, it is divisible by :" write divisor exit program set divisor to divisor +1 write "The number is prime." Writing a Program Define the problem Create a plan (algorithm) to solve the problem Translate your algorithm into code Test and make adjustments to your code and algorithm as neede Creating an Algorithm What to keep in mind when creating your algorithm Read in all needed input Proper output What are the normal cases (possibilities) based on the input? Are there any special cases? Algorithm Example Problem: Find the roots (real) of a quadratic equation. Quadratic Equation: ax2 + bx + c The ro...
View Full Document
This note was uploaded on 09/06/2013 for the course COMPUTING FE1008 taught by Professor Johnarnold during the Fall '11 term at Mapúa Institute of Technology.
- Fall '11