From f9ab50c53a7c3a9cf0e4184bbd78d894beffaf6a Mon Sep 17 00:00:00 2001 From: Josiah Elza Jacob <63003688+josiahjacob@users.noreply.github.com> Date: Sat, 31 Oct 2020 00:51:33 +0530 Subject: [PATCH 1/4] Create factorial.py added program for finding factorial --- factorial.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 factorial.py diff --git a/factorial.py b/factorial.py new file mode 100644 index 0000000..c4dc881 --- /dev/null +++ b/factorial.py @@ -0,0 +1,8 @@ +def fact(n): + if n==1: + return 1 + else: + return n*fact(n-1) + +n= int(input("Enter a no:")) +print("Factorial is : ",fact(n)) \ No newline at end of file From e5ebad9bdc9c719183cac3f3016c6f232122650c Mon Sep 17 00:00:00 2001 From: Josiah Elza Jacob <63003688+josiahjacob@users.noreply.github.com> Date: Sat, 31 Oct 2020 00:59:23 +0530 Subject: [PATCH 2/4] Create lcm.py --- lcm.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lcm.py diff --git a/lcm.py b/lcm.py new file mode 100644 index 0000000..4dbaaa2 --- /dev/null +++ b/lcm.py @@ -0,0 +1,16 @@ +def lcm(x, y): + if x > y: + greater = x + else: + greater = y + + while(True): + if((greater % x == 0) and (greater % y == 0)): + lcm = greater + break + greater += 1 + + return lcm +a=int(input("Enter the first no: ")) +b=int(input("Enter the second no: ")) +print ("Lcm is : ",lcm(a,b)) \ No newline at end of file From 89a5c5de18d0ffba37d320e5afc672ceea45dc99 Mon Sep 17 00:00:00 2001 From: Annmary Jacob <69010724+annmary-jacob@users.noreply.github.com> Date: Sat, 31 Oct 2020 13:40:16 +0530 Subject: [PATCH 3/4] Create armstrong.py --- armstrong.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 armstrong.py diff --git a/armstrong.py b/armstrong.py new file mode 100644 index 0000000..8f14991 --- /dev/null +++ b/armstrong.py @@ -0,0 +1,14 @@ +num = int(input("Enter a number: ")) +sum = 0 + +temp = num +while temp > 0: + digit = temp % 10 + sum += digit ** 3 + temp //= 10 + + +if num == sum: + print(num,"is an Armstrong number") +else: + print(num,"is not an Armstrong number") \ No newline at end of file From 489a751c89cdc975861e8d8c092ec16d4a99ca69 Mon Sep 17 00:00:00 2001 From: Annmary Jacob <69010724+annmary-jacob@users.noreply.github.com> Date: Sat, 31 Oct 2020 13:43:35 +0530 Subject: [PATCH 4/4] Create prime.py --- prime.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 prime.py diff --git a/prime.py b/prime.py new file mode 100644 index 0000000..5751ce4 --- /dev/null +++ b/prime.py @@ -0,0 +1,17 @@ +num = 407 + + + +if num > 1: + + for i in range(2,num): + if (num % i) == 0: + print(num,"is not a prime number") + print(i,"times",num//i,"is",num) + break + else: + print(num,"is a prime number") + + +else: + print(num,"is not a prime number") \ No newline at end of file