Question
1. Program 1 - Prime Number Detector a. Using pseudocode, describe an algorithm that determines whether an integer entered by the user is a prime
1. Program 1 - Prime Number Detector
a. Using pseudocode, describe an algorithm that determines whether an integer entered by the user is a prime number. Prime numbers have exactly 2 factors. So, 31 is a prime number because it can only be formed by multiplying 31 * 1. But 32 is a composite number because it can be formed by 32 * 1, 16 * 2, and 8 * 4.
b. make a flowchart that visually represents the algorithm above.
c. Convert your pseudocode and flowchart into a JavaScript program.
2. Program 2 - Factorial Calculator
a. Using pseudocode, describe an algorithm that calculates the factorial value of an integer entered by the user. Factorials are calculated by multiplying the previous numbers together. So, 3! Is 3 * 2 * 1 or 6. 4! Is 4 * 3 * 2 * 1 or 24. Be aware that 0! = 1 and 1! = 1.
b. make a flowchart that visually represents the algorithm above. c. Convert your pseudocode and flowchart into a JavaScript program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started