Fibonacci series using recursion, written in Python

def caller():
    n=int(input("How many terms:- "))
    for i in range(0,n):
      print(fibonacacci(i))
      i+=1

def fibonacci(i):
    if i<=1:
      return i
    else:
      return (fibonacci(i-1)+fibonacci(i-2))
    
Advertisements

#algorithm, #fibonacci-series, #python

Input a character and this algorithm will tell you which type of character it is.

In Python language:-

def whichar(c):

    if(c>='A'and c<='Z'):

        if(c=='A'or c=='E'or c=='I'or c=='O'or c=='U'):
            print("Is a capital letter and a vowel")
        else:
            print("Is a capital letter and a consonant")

    elif(c>='a'and c<='z'):

        if(c=='a'or c=='e'or c=='i'or c=='o'or c=='u'):
            print("Is a small case letter and a vowel")
        else:
            print("Is a small case letter and a consonant")

    elif(c>='0'and c<='9'):
        print("Is a digit")
    elif(c==' '):
        print("Is a space")
    else:
        print("Is a special character")

In C language:-

Continue reading

#c, #python