Program to Calculate Sum of Even Numbers for the given ‘n’
https://www.computersprofessor.com/2016/04/program-to-calculate-sum-of-even-numbers.html
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.