Skip to content

Commit bf3a890

Browse files
Merge branch 'master' into master
2 parents fd0faf2 + 622cb5a commit bf3a890

4 files changed

Lines changed: 47 additions & 17 deletions

File tree

README.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
# simplePythonProgram
2-
3-
This repo contains the following files:
4-
- `Bubble Sort_2.py`: a bubble sort program
5-
- `BubbleSort.py`: another bubble sort program
6-
- `Merge Sort.py`: a merge sort implementation program with user-received input.
7-
- `Fibonacci.py`: a program that takes number of digits given as input and generates a Fibonacci Sequence based on input.
8-
- `README.md`: this file
9-
- `helloworld.py`: a simple hello world program
10-
- `greet.py` : a simple program that requests user name and greets them with a specfic message.
11-
- `spam.py`: a simple program to give spam message to anyone
12-
- `Quick_sort.py`: quick sort program
13-
14-
To run spam.py install pyautogui
15-
<pre>
16-
<code>pip install pyautogui</code>
17-
</pre>
1+
# simplePythonProgram
2+
3+
This repo contains the following files:
4+
- `Bubble Sort_2.py`: a bubble sort program.
5+
- `BubbleSort.py`: another bubble sort program.
6+
- `Merge Sort.py`: a merge sort implementation program with user-received input.
7+
- `Fibonacci.py`: a program that takes number of digits given as input and generates a Fibonacci Sequence based on input.
8+
- `README.md`: this file.
9+
- `helloworld.py`: a simple hello world program.
10+
- `greet.py` : a simple program that requests user name and greets them with a specfic message.
11+
- `spam.py`: a simple program to give spam message to anyone
12+
- `Quick_sort.py`: quick sort program
13+
14+
15+
To run spam.py install pyautogui
16+
<pre>
17+
<code>pip install pyautogui</code>
18+
</pre>

factorial.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#finding factorial of a number n
2+
def fact(n):
3+
if n==0:
4+
return 1
5+
else:
6+
return n*fact(n-1)
7+
8+
n=int(input("enter a number n: "))
9+
a= "factorial of" + str(n) +"is: "
10+
print(a,fact(n))

helloworld.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Print Condition
12
print("Hello World")
23

34

strongNumber.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#A Strong number is a number whose sum of factorials of digits is equal to the same number.
2+
#Example: 145 is a Strong Number (1!+4!+5! = 145)
3+
4+
num = int(input("Enter a number\n"))
5+
temp = num
6+
sum = 0
7+
while(temp > 0):
8+
d = temp % 10
9+
f = 1
10+
while(d > 0):
11+
f = f * d
12+
d -= 1
13+
sum += f
14+
temp = temp // 10
15+
if sum == num:
16+
print("%d is a Strong Number" %(num))
17+
else:
18+
print("%d is NOT a Strong Number" %(num))

0 commit comments

Comments
 (0)