Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • System Design Tutorial
  • What is System Design
  • System Design Life Cycle
  • High Level Design HLD
  • Low Level Design LLD
  • Design Patterns
  • UML Diagrams
  • System Design Interview Guide
  • Scalability
  • Databases
Open In App
Next Article:
Programming Construction in COBOL
Next article icon

Introduction of Programming Paradigms

Last Updated : 08 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

A paradigm can also be termed as a method to solve a problem or accomplish a task. A programming paradigm is an approach to solving a problem using a specific programming language. In other words, it is a methodology for problem-solving using the tools and techniques available to us, following a particular approach. While there are many programming languages, each of them typically adheres to one or more paradigms that guide how the language is implemented.

These methodologies or strategies are referred to as programming paradigms. Apart from the variety of programming languages available, there are several paradigms that address different demands and challenges in software development. These paradigms are discussed below:

1. Imperative programming paradigm: It is one of the oldest programming paradigm. It features close relation to machine architecture. It is based on Von Neumann architecture. It works by changing the program state through assignment statements. It performs step by step task by changing state. The main focus is on how to achieve the goal. The paradigm consist of several statements and after execution of all the result is stored.

Advantages: 

  1. Very simple to implement
  2. It contains loops, variables etc.

Disadvantage:  

  1. Complex problem cannot be solved
  2. Less efficient and less productive
  3. Parallel programming is not possible
Examples of Imperative programming paradigm:
C : developed by Dennis Ritchie and Ken Thompson
Fortran : developed by John Backus for IBM
Basic : developed by John G Kemeny and Thomas E Kurtz
C++
#include <iostream>  int main() {     // Array to store marks     int marks[5] = { 12, 32, 45, 13, 19 };      // Variable to store the sum of marks     int sum = 0;      // Variable to store the average     float average = 0.0;      // Calculate the sum of marks     for (int i = 0; i < 5; i++) {         sum = sum + marks[i];     }      // Calculate the average     average = sum / 5.0;      // Output the average     std::cout << "Average of five numbers: " << average << std::endl;      return 0; } 
C
#include <stdio.h>  int main() {     // Array to store marks     int marks[5] = { 12, 32, 45, 13, 19 };      // Variable to store the sum of marks     int sum = 0;      // Variable to store the average     float average = 0.0;      // Calculate the sum of marks     for (int i = 0; i < 5; i++) {         sum = sum + marks[i];     }      // Calculate the average     average = (float)sum / 5.0;      // Output the average     printf("Average of five numbers: %.2f\n", average);      return 0; } 
Java
public class Main {     public static void main(String[] args) {         // Array to store marks         int[] marks = {12, 32, 45, 13, 19};          // Variable to store the sum of marks         int sum = 0;          // Variable to store the average         float average = 0.0f;          // Calculate the sum of marks         for (int i = 0; i < 5; i++) {             sum = sum + marks[i];         }          // Calculate the average         average = sum / 5.0f;          // Output the average         System.out.println("Average of five numbers: " + average);     } } 
Python
def main():     # Array to store marks     marks = [12, 32, 45, 13, 19]      # Variable to store the sum of marks     total_marks = sum(marks)      # Calculate the average     average = total_marks / len(marks)      # Output the average     print("Average of five numbers:", average)  if __name__ == "__main__":     main() #this code is added by Utkarsh 
JavaScript
// Array to store marks let marks = [12, 32, 45, 13, 19];  // Variable to store the sum of marks let sum = 0;  // Variable to store the average let average = 0.0;  // Calculate the sum of marks for (let i = 0; i < 5; i++) {     sum = sum + marks[i]; }  // Calculate the average average = sum / 5.0;  // Output the average console.log("Average of five numbers: " + average); 

Output
Average of five numbers: 24.2 

Imperative programming is divided into three broad categories: Procedural, OOP and parallel processing. These paradigms are as follows:

  • Procedural programming paradigm – 
    This paradigm emphasizes on procedure in terms of under lying machine model. There is no difference in between procedural and imperative approach. It has the ability to reuse the code and it was boon at that time when it was in use because of its reusability.
Examples of Procedural programming paradigm:
C : developed by Dennis Ritchie and Ken Thompson
C++ : developed by Bjarne Stroustrup
Java : developed by James Gosling at Sun Microsystems
ColdFusion : developed by J J Allaire
Pascal : developed by Niklaus Wirth
C++
#include <iostream> using namespace std; int main() {     int i, fact = 1, num;     cout << "Enter any Number: ";     cin >> number;     for (i = 1; i <= num; i++) {         fact = fact * i;     }     cout << "Factorial of " << num << " is: " << fact << endl;     return 0; } 
Java
import java.util.Scanner;  public class Main {     public static void main(String[] args) {         // Create a Scanner object for reading input         Scanner scanner = new Scanner(System.in);          // Prompt user to enter a number         System.out.println("Enter any Number: ");          // Read number from user input         int num = scanner.nextInt();          // Initialize factorial to 1         int fact = 1;          // Calculate factorial using a for loop         for (int i = 1; i <= num; i++) {             fact = fact * i;         }          // Print the factorial of the number         System.out.println("Factorial of " + num + " is: " + fact);     } } 
Python
# Prompt user to enter a number num = int(input("Enter any Number: "))  fact = 1  # Initialize factorial variable  # Calculate factorial for i in range(1, num + 1):     fact = fact * i  # Print the factorial print("Factorial of", num, "is:", fact) 
JavaScript
// Prompt the user for input let num = prompt("Enter any Number: ");  // Initialize the factorial value to 1 let fact = 1;  // Calculate the factorial of the number for (let i = 1; i <= num; i++) {     fact = fact * i; }  // Print the factorial of the number console.log("Factorial of " + num + " is: " + fact); 

Then comes OOP,

  • Object oriented programming – 
    The program is written as a collection of classes and object which are meant for communication. The smallest and basic entity is object and all kind of computation is performed on the objects only. More emphasis is on data rather procedure. It can handle almost all kind of real life problems which are today in scenario.

Advantages: 

  • Data security
  • Inheritance
  • Code reusability
  • Flexible and abstraction is also present
Examples of Object Oriented programming paradigm:
Simula : first OOP language
Java : developed by James Gosling at Sun Microsystems
C++ : developed by Bjarne Stroustrup
Objective-C : designed by Brad Cox
Visual Basic .NET : developed by Microsoft
Python : developed by Guido van Rossum
Ruby : developed by Yukihiro Matsumoto
Smalltalk : developed by Alan Kay, Dan Ingalls, Adele Goldberg
C++
// C++ program for the above approach #include <bits/stdc++.h> using namespace std;  // Class Signup class Signup {     int userid;     string name;     string emailid;     char sex;     long mob;  public:     // Function to create and object using     // the parameters     void create(int userid, string name, string emailid,                 char sex, long mob)     {         cout << "Welcome to GeeksforGeeks\nLets create "                 "your account\n";         this->userid = 132;         this->name = "Radha";         this->emailid = "[email protected]";         this->sex = 'F';         this->mob = 900558981;         cout << "your account has been created" << endl;     } };  // Driver Cpde int main() {     cout << "GfG!" << endl;      // Creating Objects     Signup s1;     s1.create(22, "riya", "[email protected]", 'F', 89002);      return 0; } 
Java
import java.io.*;  class GFG {     public static void main(String[] args)     {         System.out.println("GfG!");         Signup s1 = new Signup();         s1.create(22, "riya", "[email protected]", 'F',                   89002);     } }  class Signup {     int userid;     String name;     String emailid;     char sex;     long mob;      public void create(int userid, String name,                        String emailid, char sex, long mob)     {         System.out.println(             "Welcome to GeeksforGeeks\nLets create your account\n");         this.userid = 132;         this.name = "Radha";         this.emailid = "[email protected]";         this.sex = 'F';         this.mob = 900558981;         System.out.println("your account has been created");     } } 
Python
class Signup:     def __init__(self):         self.userid = 0         self.name = ""         self.emailid = ""         self.sex = ""         self.mob = 0      def create(self, userid, name, emailid, sex, mob):         print("Welcome to GeeksforGeeks\nLets create your account\n")         self.userid = 132         self.name = "Radha"         self.emailid = "[email protected]"         self.sex = 'F'         self.mob = 900558981         print("your account has been created")   if __name__ == "__main__":     print("GfG!")     s1 = Signup()     s1.create(22, "riya", "[email protected]", 'F', 89002) 
C#
using System;  class GFG {     static void Main(string[] args)     {         Console.WriteLine("GfG!");         Signup s1 = new Signup();         s1.create(22, "riya", "[email protected]", 'F',                   89002);     } }  class Signup {     public int userid;     public string name;     public string emailid;     public char sex;     public long mob;      public void create(int userid, string name,                        string emailid, char sex, long mob)     {         Console.WriteLine(             "Welcome to GeeksforGeeks\nLets create your account\n");         this.userid = 132;         this.name = "Radha";         this.emailid = "[email protected]";         this.sex = 'F';         this.mob = 900558981;         Console.WriteLine("your account has been created");     } } // This code is contributed by akshatve2zi2 
JavaScript
class Signup {     constructor(userid, name, emailid, sex, mob) {         this.userid = userid;         this.name = name;         this.emailid = emailid;         this.sex = sex;         this.mob = mob;     }          create(userid, name, emailid, sex, mob) {         console.log("Welcome to GeeksforGeeks\nLets create your account\n");         this.userid = 132;         this.name = "Radha";         this.emailid = "[email protected]";         this.sex = 'F';         this.mob = 900558981;         console.log("your account has been created");     } }  console.log("GfG!"); let s1 = new Signup(); s1.create(22, "riya", "[email protected]", 'F', 89002); // This code is contributed by akshatve2zi2 

Output
GfG! Welcome to GeeksforGeeks Lets create your account  your account has been created
  • Parallel processing approach – 
    Parallel processing is the processing of program instructions by dividing them among multiple processors. A parallel processing system posses many numbers of processor with the objective of running a program in less time by dividing them. This approach seems to be like divide and conquer. Examples are NESL (one of the oldest one) and C/C++ also supports because of some library function.

2. Declarative programming paradigm: 
It is divided as Logic, Functional, Database. In computer science the declarative programming is a style of building programs that expresses logic of computation without talking about its control flow. It often considers programs as theories of some logic.It may simplify writing parallel programs. The focus is on what needs to be done rather how it should be done basically emphasize on what code is actually doing. It just declares the result we want rather how it has be produced. This is the only difference between imperative (how to do) and declarative (what to do) programming paradigms. Getting into deeper we would see logic, functional and database.

  • Logic programming paradigms – 
    It can be termed as abstract model of computation. It would solve logical problems like puzzles, series etc. In logic programming we have a knowledge base which we know before and along with the question and knowledge base which is given to machine, it produces result. In normal programming languages, such concept of knowledge base is not available but while using the concept of artificial intelligence, machine learning we have some models like Perception model which is using the same mechanism. 
    In logical programming the main emphasize is on knowledge base and the problem. The execution of the program is very much like proof of mathematical statement, e.g., Prolog
predicates
sumoftwonumber(integer, integer).
clauses
sumoftwonumber(0, 0).
sumoftwonumber(N, R) :-
N > 0,
N1 is N - 1,
sumoftwonumber(N1, R1),
R is R1 + N.
  • Functional programming paradigms – 
    The functional programming paradigms has its roots in mathematics and it is language independent. The key principle of this paradigms is the execution of series of mathematical functions. The central model for the abstraction is the function which are meant for some specific computation and not the data structure. Data are loosely coupled to functions.The function hide their implementation. Function can be replaced with their values without changing the meaning of the program. Some of the languages like perl, javascript mostly uses this paradigm.
Examples of Functional programming paradigm:
JavaScript : developed by Brendan Eich
Haskell : developed by Lennart Augustsson, Dave Barton
Scala : developed by Martin Odersky
Erlang : developed by Joe Armstrong, Robert Virding
Lisp : developed by John Mccarthy
ML : developed by Robin Milner
Clojure : developed by Rich Hickey

The next kind of approach is of Database.

  • Database/Data driven programming approach – 
    This programming methodology is based on data and its movement. Program statements are defined by data rather than hard-coding a series of steps. A database program is the heart of a business information system and provides file creation, data entry, update, query and reporting functions. There are several programming languages that are developed mostly for database application. For example SQL. It is applied to streams of structured data, for filtering, transforming, aggregating (such as computing statistics), or calling other programs. So it has its own wide application.
CREATE DATABASE databaseAddress;
CREATE TABLE Addr (
PersonID int,
LastName varchar(200),
FirstName varchar(200),
Address varchar(200),
City varchar(200),
State varchar(200)
);


Next Article
Programming Construction in COBOL

B

Bhumika_Rani
Improve
Article Tags :
  • Design Pattern
  • Programming
  • System Design
  • Object-Oriented-Design
  • Technical Scripter 2018

Similar Reads

  • Programming Paradigms in Python
    Paradigm can also be termed as a method to solve some problems or do some tasks. A programming paradigm is an approach to solve the problem using some programming language or also we can say it is a method to solve a problem using tools and techniques that are available to us following some approach
    4 min read
  • Introduction to Visual Programming Language
    Any language that uses the graphics or blocks that are already defined with the code and you just need to use those blocks without worrying about the lines of code is known as a visual programming language. In today's era majority of the programming languages are text-based i.e. we have to write the
    6 min read
  • Programming Construction in COBOL
    COBOL is a compiled, imperative, procedural programming language designed for business use. It can handle very large numbers and strings. COBOL is still in use today because it's robust, with an established code base supporting sprawling enterprise-wide programs. Learning to program in COBOL will se
    5 min read
  • Functions in Programming
    Functions in programming are modular units of code designed to perform specific tasks. They encapsulate a set of instructions, allowing for code reuse and organization. In this article, we will discuss about basics of function, its importance different types of functions, etc. Table of Content What
    14 min read
  • Programming Language Generations
    A computer is a digital machine. It can only understand electric signals either ON or OFF or 1 or 0. But how do we communicate with this digital machine? Just like there are multiple languages we communicate with each other (e.g., English, Hindi, Tamil, Gujarati, etc.). But computers cannot understa
    6 min read
  • Loops in Programming
    Loops or Iteration Statements in Programming are helpful when we need a specific task in repetition. They're essential as they reduce hours of work to seconds. In this article, we will explore the basics of loops, with the different types and best practices. Table of Content What are Loops in Progra
    12 min read
  • Types of Operators in Programming
    Types of operators in programming are symbols or keywords that represent computations or actions performed on operands. Operands can be variables, constants, or values, and the combination of operators and operands form expressions. Operators play a crucial role in performing various tasks, such as
    15+ min read
  • Modular Approach in Programming
    Modular programming is the process of subdividing a computer program into separate sub-programs. A module is a separate software component. It can often be used in a variety of applications and functions with other components of the system. Some programs might have thousands or millions of lines and
    3 min read
  • Introduction to LISP
    Lisp is a programming language that has an overall style that is organized around expressions and functions. Every Lisp procedure is a function, and when called, it returns a data object as its value. It is also commonly referred to as "functions" even though they may have side effects. Lisp is the
    2 min read
  • Basic Programming Problems
    Learn Programming – How To Code In the world of programming, mastering the fundamentals is key to becoming a proficient developer. In this article, we will explore a variety of basic programming problems that are essential for every aspiring coder to understand. By delving into these foundational ch
    4 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences