Repository navigation
Expand file tree
/
Copy path003-Procedural-Style-Example.py
More file actions
64 lines (52 loc) · 2.66 KB
/
Copy path003-Procedural-Style-Example.py
File metadata and controls
64 lines (52 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"""
===============================================================================
Procedural Style Example
===============================================================================
Program Description:
--------------------
This program demonstrates the Procedural Programming style in Python.
Procedural Programming is a programming paradigm in which a program is organized as a sequence of instructions. The statements are executed one after another from top to bottom.
Author : Shaik Mahaboob Basha
Repository : 13-Python
File Name : 03-Procedural-Style-Example.py
===============================================================================
"""
# -----------------------------------------------------------------------------
# Displaying the program title.
# -----------------------------------------------------------------------------
print("Procedural Programming Example")
# Output: Procedural Programming Example
# -----------------------------------------------------------------------------
# Creating two integer variables.
# These variables store the values that will be used for addition.
# -----------------------------------------------------------------------------
num1 = 10
# num1 stores the value 10.
num2 = 20
# num2 stores the value 20.
# -----------------------------------------------------------------------------
# Adding the values stored in num1 and num2.
# The result is stored in the variable named sum.
# -----------------------------------------------------------------------------
sum = num1 + num2
# sum stores the value 30.
# -----------------------------------------------------------------------------
# Displaying the value of the first number.
# -----------------------------------------------------------------------------
print("First Number :", num1)
# Output: First Number : 10
# -----------------------------------------------------------------------------
# Displaying the value of the second number.
# -----------------------------------------------------------------------------
print("Second Number :", num2)
# Output: Second Number : 20
# -----------------------------------------------------------------------------
# Displaying the addition result.
# -----------------------------------------------------------------------------
print("Sum =", sum)
# Output: Sum = 30
# -----------------------------------------------------------------------------
# Displaying a concluding message about procedural programming.
# -----------------------------------------------------------------------------
print("The program executed sequentially from top to bottom.")
# Output: The program executed sequentially from top to bottom.