Computer Science, asked by DORAEMONDA2137, 11 months ago

What is a procedural programming? Give some of its examples.?

Answers

Answered by Hacket
0

Procedural Programming is all about creating procedures with a logic to solve a specific problem. Let’s say you have four problems to solve, adding two numbers, subtracting one number from another, multiplying two numbers, dividing a number by another number.

For this, we can create four procedures (the below example is not in any particular language)

procedure 1: public int add(int a, int b) { return a-b;}

procedure 2: public int subtract(int a, int b) { return a-b;}

procedure 3: public int multiply(int a, int b) {return a*b;}

procedure 4: public int divide(int a, int b) {return a/b;}

Now, you can call these procedures any number of times from a main procedure (main method, for instance).

Languages like, C, PASCAL, COBOL support this kind of programming, which is called procedural programming or procedure oriented programming (POP)

In this POP, we would break a complex system (problem) into smaller pieces (called procedures) and the main method would call these procedures whenever needed.

This is otherwise called as TOP-DOWN approach (start from a big, and end with smaller pieces - decomposition)

Thanksss for asking

Similar questions