Repository navigation
Expand file tree
/
Copy path053-Basic-Calculator-Using-Hard-Coding.py
More file actions
85 lines (71 loc) · 3.35 KB
/
Copy path053-Basic-Calculator-Using-Hard-Coding.py
File metadata and controls
85 lines (71 loc) · 3.35 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
"""
===============================================================================
Basic Calculator Using Hard Coding
===============================================================================
Program Description:
--------------------
This program demonstrates a basic calculator using hard-coded values.
The values are assigned directly inside the program. The program performs
basic arithmetic operations such as addition, subtraction,
multiplication, division, modulus, floor division, and exponentiation.
Author : Shaik Mahaboob Basha
Repository : 13-Python
File Name : 53-Basic-Calculator-Using-Hard-Coding.py
===============================================================================
"""
# -----------------------------------------------------------------------------
# Assigning hard-coded values to two variables.
# -----------------------------------------------------------------------------
number1 = 20
number2 = 5
# number1 = 20
# number2 = 5
# -----------------------------------------------------------------------------
# Displaying the input values.
# -----------------------------------------------------------------------------
print("First Number :", number1)
print("Second Number :", number2)
# Output:
# First Number : 20
# Second Number : 5
# -----------------------------------------------------------------------------
# Performing addition.
# -----------------------------------------------------------------------------
print("Addition :", number1 + number2)
# Output: Addition : 25
# -----------------------------------------------------------------------------
# Performing subtraction.
# -----------------------------------------------------------------------------
print("Subtraction :", number1 - number2)
# Output: Subtraction : 15
# -----------------------------------------------------------------------------
# Performing multiplication.
# -----------------------------------------------------------------------------
print("Multiplication :", number1 * number2)
# Output: Multiplication : 100
# -----------------------------------------------------------------------------
# Performing division.
# -----------------------------------------------------------------------------
print("Division :", number1 / number2)
# Output: Division : 4.0
# -----------------------------------------------------------------------------
# Performing modulus operation.
# -----------------------------------------------------------------------------
print("Modulus :", number1 % number2)
# Output: Modulus : 0
# -----------------------------------------------------------------------------
# Performing floor division.
# -----------------------------------------------------------------------------
print("Floor Division :", number1 // number2)
# Output: Floor Division : 4
# -----------------------------------------------------------------------------
# Performing exponentiation.
# -----------------------------------------------------------------------------
print("Exponentiation :", number1 ** number2)
# Output: Exponentiation : 3200000
# -----------------------------------------------------------------------------
# Displaying a completion message.
# -----------------------------------------------------------------------------
print("Program Completed.")
# Output:
# Program Completed.