Q1.Write an algorithm to find the exponent of a given number .

Ans: Planning the Solution:
Input: A number and its exponent.
Required Output: Exponent of given number.
Processing: Multiply the number as many times as its exponent.
Algorithm:
Step 1: Start
Let the numbers, N be 8 and its exponent,
                    E be 5.
Step 2: Initialize product(P) and K to 1.
                    P=1, K=1
Step 3: Find the Product(P)
                    P=P*N
Step 4: Increment K by 1.
                    K=K+1
Step 5: Check if the value of K is less than or equal to E
            If K ≤ E then goto step 3 otherwise goto step 6.
Step 6: Output P
Step 7: Stop
Algorithm

 




Comments

Popular posts from this blog

Conditional Control structure. Chapter 4, Lab Activities, Long questions.

Chapter # 5, Loop Control Structure, Lab Activities