Program to Calculate Sum of Even Numbers for the given ‘n’

PROGRAM TO CALCULATE THE SUM OF EVEN NO’S UPTO THE GIVEN ‘N’:


Sql <>Ed sum.SQL

Declare

No number :=&no;

i, s number := 0;

begin

for I in 1….no

loop

if mod (I, 2)=0 then

s=s + I;

End if;

End loop;

Dbms-output.put_line (‘sum of even no is’ || (s));

End;



Output

N=10sum

Sum of Even no is 30.

Related

Oracle 2841391590480605213

Post a Comment

emo-but-icon

item