-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasicPrograms.py
More file actions
94 lines (58 loc) · 1.81 KB
/
BasicPrograms.py
File metadata and controls
94 lines (58 loc) · 1.81 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
86
87
88
89
90
91
92
93
94
# WAP to add two numbers
""" num1 = int(input("Enter the first number: "))
num2 = int(input("Enter the second number: "))
sum = num1 + num2
print(f"Sum of two number is : {sum}") """
# WAP to find Maximum of two numbers
""" def maximum(x, y):
if (x >= y):
return print(f"{x} is the maximum number")
else :
return print(f"{y} is the maximum number")
a = int(input("Enter the first number: "))
b = int(input("Enter the second number: "))
maximum(a , b) """
# WAP for factorial of a number
""" n = int(input("Enter a number: "))
if (n==1 or n==0):
print(f"Factorial is: ", 1)
else:
fact = 1
for i in range(1 , n+1):
fact *= i
print(f"factorial is : {fact}") """
# WAP for Simple intrest
""" def simpleIntresr(p, t, r):
print("The principal amount is", p)
print("The time period is", t)
print("The rate of intrest is", r)
si = (p * r * t)/100
print(f"The Simple Intrest is : {si}")
P = int(input("Enter the principal amount :"))
T = int(input("Enter the time period :"))
R = int(input("Enter the rate of interest :"))
simpleIntresr(P, T, R) """
# WAP to check number is Armstrong Number or not
""" num1 = input("Enter a number: ")
l = len(str(num1))
num = int(num1)
sum = 0
for d in num1:
sum += int(d)**l
if (sum == num):
print(f"{num} is an Armstrong Number")
else :
print(f"{num} is not an Armstrong Number") """
# WAP to find area of a circle
""" radius = int(input("Enter the value of radius: "))
pi = 3.1415
Area_of_circle = pi * (radius) ** 2
print(f"Area of circle : {Area_of_circle}") """
# WAP print all Prime numbers in an Interval of 1 to 100
for i in range(1, 11):
if i > 1:
for j in range(2, i):
if (i % j == 0):
break
else:
print(i)