Professional Documents
Culture Documents
Programming Activity 7
Programming Activity 7
Learning Competencies:
1.1. Creating variables
1.2. Identifying constants in programming
1.3. Writing code using the correct syntax in programming
1.4. Using conditions in running programs
1.5. Using for loop in your program
PROGRAMMING EXERCISE
Use a while loop that will compute all the factorial, square or cube of the
value entered by the user.
SQUARE OF 1 IS 1
SQUARE OF 2 IS 4
SQUARE OF 3 IS 9
SQUARE OF 4 IS 16
SQUARE OF 5 IS 25
SQUARE OF 6 IS 36
SQUARE OF 7 IS 49
EXAMPLE: User entered F and 11.
FACTORIAL OF 11 IS 39916800
CUBE OF 1 IS 1
CUBE OF 2 IS 8
CUBE OF 3 IS 27
CUBE OF 4 IS 64
CUBE OF 5 IS 125
1. ALGORITHM
AGORITHM
1. Declare Variables for the input number, square, cube, the value of factorial (1)
and n (0).
Use a while loop that will compute all the factorial, square or cube of the
value entered by the user.
3.3. Write the correct program and the expected output above.
PROGRAM
EXPECTED OUTPUT