From fb7ca2fe62c247ef2b066161c2654bf8d96be3b3 Mon Sep 17 00:00:00 2001 From: Aakash Date: Sat, 3 Oct 2020 02:41:34 +0530 Subject: [PATCH 1/7] Create factorial.py --- Python/program-5/factorial.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Python/program-5/factorial.py diff --git a/Python/program-5/factorial.py b/Python/program-5/factorial.py new file mode 100644 index 00000000..9db2639b --- /dev/null +++ b/Python/program-5/factorial.py @@ -0,0 +1,14 @@ +fact=int(input("input any number")) +# input any number +factorial =1 +#predefined factorial of 0 +if fact<0: + print("factorial is not possible") +elif fact==0: + print("factorial of "+str(fact) +" is "+str(factorial)) +else: + fact1=fact + while(fact>2): + fact-=1 + fact1=fact1*(fact) + print("factorial is "+ str(fact1)) \ No newline at end of file From 37c526a70568b7bc75269357ef604a4f53484b49 Mon Sep 17 00:00:00 2001 From: Aakash Date: Sat, 3 Oct 2020 03:25:17 +0530 Subject: [PATCH 2/7] Create README.md --- Python/program-5/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Python/program-5/README.md diff --git a/Python/program-5/README.md b/Python/program-5/README.md new file mode 100644 index 00000000..669d2d67 --- /dev/null +++ b/Python/program-5/README.md @@ -0,0 +1,7 @@ +Program 5 + +Write a program to find a factorial of a number. + +Variable description-- +fact= Holds the input number + From 5d6c7c097a09cea062c0b1fc1e16c230a1432c0b Mon Sep 17 00:00:00 2001 From: Aakash Date: Sat, 3 Oct 2020 03:28:55 +0530 Subject: [PATCH 3/7] Create prime number.py --- Python/program-6/prime number.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Python/program-6/prime number.py diff --git a/Python/program-6/prime number.py b/Python/program-6/prime number.py new file mode 100644 index 00000000..8b70a1d6 --- /dev/null +++ b/Python/program-6/prime number.py @@ -0,0 +1,14 @@ +n=int(input("enter any number")) +# n is the number to check whether it is prime or not +if n>1: + # loop from 2 to n/2 + for i in range(2,int(n/2)): + + if(n%i)==0: + #if n is completly divisible by i then it is not a prime number + print("n is not prime") + break + else: + print("n is prime") +else: + print("not prime") From f6b46b81958fff146b5af86181c5fc6bd7619255 Mon Sep 17 00:00:00 2001 From: Aakash Date: Sat, 3 Oct 2020 03:28:59 +0530 Subject: [PATCH 4/7] Create README.md --- Python/program-6/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Python/program-6/README.md diff --git a/Python/program-6/README.md b/Python/program-6/README.md new file mode 100644 index 00000000..3caf41e7 --- /dev/null +++ b/Python/program-6/README.md @@ -0,0 +1,8 @@ +Program 5 + +Write a program to check whether a number is prime or not. + +Variable description-- +n holds the input value + + From cfc92dd52d5b79919bac34f8ff15b8f82b1b6d4f Mon Sep 17 00:00:00 2001 From: aakashjain71098 <35416709+aakashjain71098@users.noreply.github.com> Date: Sat, 3 Oct 2020 03:39:53 +0530 Subject: [PATCH 5/7] Delete prime number.py --- Python/program-6/prime number.py | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 Python/program-6/prime number.py diff --git a/Python/program-6/prime number.py b/Python/program-6/prime number.py deleted file mode 100644 index 8b70a1d6..00000000 --- a/Python/program-6/prime number.py +++ /dev/null @@ -1,14 +0,0 @@ -n=int(input("enter any number")) -# n is the number to check whether it is prime or not -if n>1: - # loop from 2 to n/2 - for i in range(2,int(n/2)): - - if(n%i)==0: - #if n is completly divisible by i then it is not a prime number - print("n is not prime") - break - else: - print("n is prime") -else: - print("not prime") From 7b73ee0be538d46aca31b880ae9dbdda20f9b63c Mon Sep 17 00:00:00 2001 From: aakashjain71098 <35416709+aakashjain71098@users.noreply.github.com> Date: Sat, 3 Oct 2020 03:40:17 +0530 Subject: [PATCH 6/7] Update README.md --- Python/program-6/README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Python/program-6/README.md b/Python/program-6/README.md index 3caf41e7..8b137891 100644 --- a/Python/program-6/README.md +++ b/Python/program-6/README.md @@ -1,8 +1 @@ -Program 5 - -Write a program to check whether a number is prime or not. - -Variable description-- -n holds the input value - From 8296e9548f7ca4637b9700104196ae165979527f Mon Sep 17 00:00:00 2001 From: aakashjain71098 <35416709+aakashjain71098@users.noreply.github.com> Date: Sat, 3 Oct 2020 03:40:29 +0530 Subject: [PATCH 7/7] Delete README.md --- Python/program-6/README.md | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Python/program-6/README.md diff --git a/Python/program-6/README.md b/Python/program-6/README.md deleted file mode 100644 index 8b137891..00000000 --- a/Python/program-6/README.md +++ /dev/null @@ -1 +0,0 @@ -