**SUM OF SERIES:**

To find the sum of series

**ALGORITHM:**

Start the program.

Get the number of terms n.

Start the loop.

Compute the sum.

Increment the sum.

Exit the loop.

Output the sum.

Stop the program.

**PROGRAM:**

SQL> set serveroutput on

SQL> declare

2 n number(3):=&n;

3 i number(3):=1;

4 x number(3):=0;

5 begin

6 loop

7 x:=x+i;

8 exit when i=n;

9 i:=i+1;

10 end loop;

11 dbms_output.put_line('sum='x);

12 end;

13 /

## 0 comments:

Post a Comment