Program to Calculate Sum and Average

PROGRAM TO CALCULATE SUM AND AVERAGE OF ‘N’ NATURAL NUMBERS


SQL >Ed sumandAvg.SQL

Declare

I number: = 1;

N number: = &n;

Sum number;

Avg number;

Begin

While(i<=n)

Loop

Sum sum + i;

i = i + 1;

End loop;

Avg := sum/n:

Dbms-output.Put_Line (‘sum of natural no’ s || (sum)];

Dbms_output.Put_line(‘Average is || (avg);

End;



Output

N=10

Sum of natural no’s 55

Average is 5.5

Related

RDBMS Keys & Constraints

There are two types of data constraints that can be applied to data inserted into a oracle table. There are I/O constraint [input/output] and business rule constraint. I/O CONSTRAINTS The inpu...

Oracle and its process

INTRODUCTION: Oracle is an RDBMS software provided by oracle development software cor poration .The RDBMS software supports the user declarative statements which describe the rules that the data ...

Data Model & Classification of Data Models

DEFINITION: A data model is an abstraction of reality. The reality may be a business system or an engineering system. DATA MODEL: Data model is an abstraction of data about entities of a sy...

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item