-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasicMathOperations.py
More file actions
79 lines (68 loc) · 2.07 KB
/
BasicMathOperations.py
File metadata and controls
79 lines (68 loc) · 2.07 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
################################
# Author: Rahim Siddiq
# Basic Math Operations
################################
# Exercise 1
print("Hello, World")
name = input("please enter your name: ")
print("Welcome Mr.", name)
rooms = int(input("How many rooms?: "))
price = float(input("Select price per room: "))
print("Price per room is", price)
print("Number of rooms reserved:", rooms)
price = price + (price * 10 / 100)
total = rooms * price
print("Total price after 10% tax:", total)
# Problem 1
print("Please enter two numbers to be added together")
x = int(input("Enter first number: "))
y = int(input("Enter second number: "))
sum = x + y
print(x, "+", y)
print("Sum:", sum)
# Problem 2
print("Difference Calculator")
print("Please enter two numbers")
x = int(input("Enter first number: "))
y = int(input("Enter second number to be subtracted from first: "))
diff = x - y
print(x, "-", y)
print("Difference:", diff)
# Problem 3
print("Please enter two numbers to be multiplied")
x = int(input("Enter first number: "))
y = int(input("Enter second number: "))
mult = x * y
print(x, "*", y)
print(mult)
# Problem 4
print("Please enter two numbers to be divided")
x = int(input("Enter first number: "))
y = int(input("Enter second number to divide the first: "))
div = x / y
print(x, "/", y)
print(div)
# Problem 5
print("Exponential Calculator")
print("Please enter two numbers, the first will be raised to the power of the second")
x = int(input("Enter first number: "))
y = int(input("Enter second number: "))
exp = x ** y
print(x, "**", y)
print(exp)
# Problem 6
print("Remainder division")
print("Please enter two numbers, the first will be divided by the second and will find any remainders")
x = int(input("Enter first number: "))
y = int(input("Enter second number: "))
divr = x % y
print(x, "/", y)
print("Remainder:", divr)
# Problem 7
print("Whole integer division")
print("Please enter two numbers, the first will be divided by the second, result rounded down to whole number")
x = int(input("Enter first number: "))
y = int(input("Enter second number: "))
divw = x // y
print(x, "/", y)
print(divw)