Name: jeriel antipuesto yara
Course and section: bs-infotech 2-c
Instructor: levi esmero
Subject:object oriented programming
Provide the required ALGORITHM of the following problems.
1. Write an ALGORITHM to find the largest among three different
numbers entered by the user.
<p>
Step 1: Start
Step 2: Input variables a, b, and c.
Step 3: Read variables a, b, and c.
Step 4: If a > b and > c
Display a is the largest number.
Else IF a < b and b > c
Display b is the largest number.
ELSE IF a < b and b</c
Display c is the largest number.
END IF
Step 5: Stop
</p>
2. Write an ALGORITHM to find the fractorial of a number entered
by the user. Fractorial of a number is determined by the following
formula.
If the user inputs 4, 4! = 4 x 3 x 2 x 1 = 24
If the user inputs 5, 5! = 5 x 4 3 x 2 x 1 = 120
<p>
Step 1. Start
Step 2. Declare variable of factor = 1.
Step 3. Input number x.
Step 4. Start for loop (initial value 1) less than or equal to the
number given.
Step 5. In the loop multiply factor with i and assign it to and
increment i.
Step 6. Print the value of ans
Step 7. Stop
</p>
3. Write an ALGORITHM to check whether a number entered by the
user is prime or not. In math, prime numbers are whole numbers
greater than 1, that have only two factors – 1 and the number
itself. Ex. Of prime numbers are 2,3,5,7,11,13,17,…
<p>
Step 1: Start
Step 2: Declare variables isPrime = true and x.
Step 3: Input number n.
Step 4: Start for loop(initial value 2) less than or equal num
divided by 2.
Step 5: Inside the loop assign num%i to x,
If x is equal to 0, set is Prime to false, and break
Step 6: Print the value of ans
Step 7: Stop
</p>