Skip to content

Commit 4520f18

Browse files
SpreehaMadhavBahl
authored andcommitted
1 parent 2f61404 commit 4520f18

File tree

8 files changed

+186
-0
lines changed

8 files changed

+186
-0
lines changed

Day1/Java/dailycodebase

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 251a720738c674bd4e8bf33fd82e917a7c6f5119

day13/Python/fact.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'''
2+
@author spreeha
3+
@date 07/01/19
4+
'''
5+
n=int(input())
6+
def factorial(n):
7+
if n==0:
8+
return 1
9+
else:
10+
return n*factorial(n-1)
11+
f=factorial(n)
12+
print(f)
13+
14+
15+

day13/Python/fibo.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'''
2+
@author spreeha
3+
@date 07/01/98
4+
'''
5+
n=int(input())
6+
def fibonacci(n):
7+
if n>=1 and n<=2:
8+
return 1
9+
else:
10+
return fibonacci(n-1)+fibonacci(n-2)
11+
for i in range(1,n):
12+
t=fibonacci(i)
13+
print(t,end=", ")
14+
print(fibonacci(n))

day13/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,22 @@ print("factorial of %d is %d" % (n, factorial(n)))
168168

169169
```
170170

171+
#### [Solution ](./Python/fact.py)
172+
```python
173+
'''
174+
@author spreeha
175+
@date 07/01/19
176+
'''
177+
n=int(input())
178+
def factorial(n):
179+
if n==0:
180+
return 1
181+
else:
182+
return n*factorial(n-1)
183+
f=factorial(n)
184+
print(f)
185+
```
186+
171187
#### [Solution by @aaditkamat](./Python/factorial_aadit.py)
172188
```python
173189
"""
@@ -474,6 +490,24 @@ else:
474490
print(", ".join(map(str, fib_series)))
475491
```
476492

493+
#### [Solution by @spreeha](./Python/fibo.py)
494+
```python
495+
'''
496+
@author spreeha
497+
@date 07/01/98
498+
'''
499+
n=int(input())
500+
def fibonacci(n):
501+
if n>=1 and n<=2:
502+
return 1
503+
else:
504+
return fibonacci(n-1)+fibonacci(n-2)
505+
for i in range(1,n):
506+
t=fibonacci(i)
507+
print(t,end=", ")
508+
print(fibonacci(n))
509+
```
510+
477511
#### [Solution by @aaditkamat](./Python/fibonacci_aadit.py)
478512
```python
479513
"""

day14/Java/Recmultiply.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* To change this license header, choose License Headers in Project Properties.
3+
* To change this template file, choose Tools | Templates
4+
* and open the template in the editor.
5+
*/
6+
package recursion;
7+
8+
/**
9+
* @date 08/01/19
10+
* @author SPREEHA DUTTA
11+
*/
12+
import java.util.*;
13+
public class Recmultiply {
14+
public static int product(int m,int n)
15+
{
16+
if (n==0)
17+
return 0;
18+
else
19+
return m+product(m,n-1);
20+
}
21+
public static void main(String []args)
22+
{
23+
int m,n,p;
24+
Scanner sc=new Scanner(System.in);
25+
System.out.println("Enter two numbers ");
26+
m=sc.nextInt();
27+
n=sc.nextInt();
28+
p=product(Math.abs(m),Math.abs(n));
29+
if((m<0&&n>0)||(m>0&&n<0))
30+
p=p*-1;
31+
System.out.println(p);
32+
}
33+
}

day14/Java/Sumrec.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* To change this license header, choose License Headers in Project Properties.
3+
* To change this template file, choose Tools | Templates
4+
* and open the template in the editor.
5+
*/
6+
package recursion;
7+
8+
/**
9+
* @date 08/01/19
10+
* @author SPREEHA DUTTA
11+
*/
12+
import java.util.*;
13+
public class Sumrec {
14+
public static int sum(int n)
15+
{
16+
if(n==0)
17+
return 0;
18+
else
19+
return n%10+sum(n/10);
20+
}
21+
public static void main(String []args)
22+
{
23+
int n,s;
24+
Scanner sc=new Scanner(System.in);
25+
System.out.println("Enter a number");
26+
n=sc.nextInt();
27+
s=sum(n);
28+
System.out.println(s);
29+
}
30+
}

day14/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,33 @@ public class SumDigits {
9090
}
9191
```
9292

93+
#### [Solution](./Java/Sumrec.java)
94+
95+
/**
96+
* @date 08/01/19
97+
* @author SPREEHA DUTTA
98+
*/
99+
import java.util.*;
100+
public class Sumrec {
101+
public static int sum(int n)
102+
{
103+
if(n==0)
104+
return 0;
105+
else
106+
return n%10+sum(n/10);
107+
}
108+
public static void main(String []args)
109+
{
110+
int n,s;
111+
Scanner sc=new Scanner(System.in);
112+
System.out.println("Enter a number");
113+
n=sc.nextInt();
114+
s=sum(n);
115+
System.out.println(s);
116+
}
117+
}
118+
```
119+
93120
### C++ Implementation
94121
95122
#### [C++ Solution by @profgrammer](./C++/profgrammer_sumdigits.cpp)
@@ -262,6 +289,37 @@ public class Product {
262289
}
263290
```
264291

292+
#### [Solution](./Java/Recmultiply.java)
293+
294+
```java
295+
/**
296+
* @date 08/01/19
297+
* @author SPREEHA DUTTA
298+
*/
299+
import java.util.*;
300+
public class Recmultiply {
301+
public static int product(int m,int n)
302+
{
303+
if (n==0)
304+
return 0;
305+
else
306+
return m+product(m,n-1);
307+
}
308+
public static void main(String []args)
309+
{
310+
int m,n,p;
311+
Scanner sc=new Scanner(System.in);
312+
System.out.println("Enter two numbers ");
313+
m=sc.nextInt();
314+
n=sc.nextInt();
315+
p=product(Math.abs(m),Math.abs(n));
316+
if((m<0&&n>0)||(m>0&&n<0))
317+
p=p*-1;
318+
System.out.println(p);
319+
}
320+
}
321+
```
322+
265323
### C++ Implementation
266324

267325
#### [C++ Solution by @profgrammer](./C++/profgrammer_product.cpp)

day9/dailycodebase

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit e95480ab4bde1c11326b1a5b925ec0447e821dbb

0 commit comments

Comments
 (0)