Skip to content

Commit

Permalink
Merge pull request #149 from arnab-2001/Python-fibonacci
Browse files Browse the repository at this point in the history
 Fixed Issue #1
  • Loading branch information
Twiggecode authored Aug 19, 2021
2 parents 3ad3adb + 03d97ec commit bfe7ebf
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Fibonacci Series/fibonacci.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Function to return the Nth number of the modified Fibonacci series where A and B are the first two terms
def findNthNumber(a, b, n):

# To store the current element which is the sum of previous two elements of the series
sum = 0

# This loop will terminate when the Nth element is found
for i in range(2, n):
sum = a + b
a = b
b = sum

# Return the Nth element
return sum

# Driver code
if __name__ == '__main__':
a = 5
b = 7
n = 10

print(findNthNumber(a, b, n))


#the output is 343
# you can test it by using any number of your choice
16 changes: 16 additions & 0 deletions Sorting Number/Sorting_number.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

// Arrays.sort().
// It by default sorts in ascending order.
import java.util.Arrays;

public class SortingNumber {
public static void main(String[] args)
{
int[] arr = { 13, 7, 6, 45, 21, 9, 101, 102 };

Arrays.sort(arr);

System.out.printf("Sorted arr[] : %s",
Arrays.toString(arr));
}
}

0 comments on commit bfe7ebf

Please sign in to comment.