File tree Expand file tree Collapse file tree 1 file changed +67
-2
lines changed
Expand file tree Collapse file tree 1 file changed +67
-2
lines changed Original file line number Diff line number Diff line change 223223# result = timeConversion(s)
224224# print(result)
225225
226- #Find the Unique numbers in the list
226+ # Find the Unique numbers in the list
227227# def lonelyinteger(a):
228228# b = sorted(a)
229229# for i in range(len(b)):
286286# if(check(strng)==True):
287287# print("The string is a pangram")
288288# else:
289- # print("The string isn't pangram")
289+ # print("The string isn't pangram")
290+
291+ # n = int(input("Enter length of Fibonacci series: "))
292+ # num1 = 0
293+ # num2 = 1
294+ # next_number = 0
295+ # count = 1
296+ # cot = 1
297+ # while (count <= n):
298+ # if cot % 11 == 0:
299+ # print("\n")
300+ # else:
301+ # print(next_number, end=" ")
302+ # count += 1
303+ # num1 = num2
304+ # num2 = next_number
305+ # next_number = num1 + num2
306+ # t_number = num1 + num2
307+ # cot += 1
308+
309+ import math
310+ def Fibonacci (n ):
311+ # Check if input is 0 then it will
312+ # print incorrect input
313+ if n < 0 :
314+ print ("Incorrect input" )
315+
316+ # Check if n is 0
317+ # then it will return 0
318+ elif n == 0 :
319+ return 0
320+
321+ # Check if n is 1,2
322+ # it will return 1
323+ elif n == 1 or n == 2 :
324+ return 1
325+
326+ else :
327+ return Fibonacci (n - 1 ) + Fibonacci (n - 2 )
328+
329+
330+ # Driver Program
331+ m = int (input ())
332+ print (Fibonacci (m ))
333+
334+
335+ def min_max (arr ):
336+ max = arr [0 ]
337+ min = arr [0 ]
338+ for num in arr :
339+ if num > max :
340+ max = num
341+ if num < min :
342+ min = num
343+ return max , min
344+
345+ n = int (input ("Enter the size of the array: " ))
346+ arr = []
347+ for i in range (n ):
348+ arr .append (int (input (f"Enter element { i + 1 } : " )))
349+ max , min = min_max (arr )
350+ print (f"The maximum element is { max } " )
351+ print (f"The minimum element is { min } " )
352+
353+
354+
You can’t perform that action at this time.
0 commit comments