A Program instruction that repeats some sequence of statement in a specified number of times. Below are some examples of simple for loop.
Example No 1. Output 2, 4 and 6 in column A and 1, 2 and 3 in column B.
Example No 2. Ask the user to input a value and calculate its factorial value (n!). Example: if the number is 4, the result should be 24 (formula: 1x2x3x4).
No comments:
Post a Comment