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))
    

#algorithm, #fibonacci-series, #python

An algorithm to compute the smallest number of notes required to combine the input amount

/*
Author:- Mayukh Datta
Website:- https://thecoducer.github.io
*/
#include<stdio.h>
void main()
{
    long amt;
    int note2000,note500,note100,note50,note20,note10,note5,note2,note1;

    //Initialize all note variables to 0
    note2000=note500=note100=note50=note20=note10=note5=note2=note1=0;

    printf("Enter an amount:- ");
    scanf("%ld", &amt);

    printf("\nDenominations:- \n");

    if(amt>=2000)
    {
        note2000=amt/2000;
        amt=amt-(note2000*2000);

        if(note2000>0)
            printf("2000*%d\n", note2000);

    }
    if(amt>=500)
    {
        note500=amt/500;
        amt=amt-(note500*500);

        if(note500>0)
            printf("500*%d\n", note500);
    }
    if(amt>=100)
    {
        note100=amt/100;
        amt=amt-(note100*100);

        if(note100>0)
            printf("100*%d\n", note100);
    }
    if(amt>=50)
    {
        note50=amt/50;
        amt=amt-(note50*50);

        if(note50>0)
            printf("50*%d\n", note50);
    }
    if(amt>=20)
    {
        note20=amt/20;
        amt=amt-(note20*20);

        if(note20>0)
            printf("20*%d\n", note20);
    }
    if(amt>=10)
    {
        note10=amt/10;
        amt=amt-(note10*10);

        if(note10>0)
            printf("10*%d\n", note10);
    }
    if(amt>=5)
    {
        note5=amt/5;
        amt=amt-(note5*5);

        if(note5>0)
            printf("5*%d\n", note5);
    }
    if(amt>=2)
    {
        note2=amt/2;
        amt=amt-(note2*2);

        if(note2>0)
            printf("2*%d\n", note2);
    }
    if(amt>=1)
    {
        note1=amt;

        if(note1>0)
            printf("1*%d\n", note1);
    }
}

#c, #indian-currency, #least-notes-required-algorithm

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

According to the Gregorian calendar, it was Monday on 01/01/01. C program to find out what is the day on 1st January of the input year.

#include<stdio.h>
void main()
{
    int yr, ref_yr=2001, diff, lpyr, nmyr, td, day;

    /** Variable Explanation:-
    yr= requested year input
    ref_yr= reference year
    diff= difference b/w ref_yr & yr
    lpyr= leap years b/w ref_yr & yr
    nmyr= normal years b/w ref_yr & yr
    td= total no. of days b/w ref_yr & yr
    day= stores the day of the week
    **/

    printf("Enter a year:- ");
    scanf("%d", &yr);

    diff=yr-ref_yr;

    lpyr=diff/4;

    nmyr=diff-lpyr;

    td=((nmyr*365)+(lpyr*366));

    day=td%7;

    if (day==0)
        printf("\nMonday\n");
    else if (day==1)
        printf("\nTuesday\n");
    else if (day==2)
        printf("\nWednesday\n");
    else if (day==3)
        printf("\nThursday\n");
    else if (day==4)
        printf("\nFriday\n");
    else if (day==5)
        printf("\nSaturday\n");
    else if (day==6)
        printf("\nSunday\n");

}

#c

C program to tell your zodiac sign, just input your birth date and month.

#include<stdio.h>
void main()
{
    int d,m;

    printf("Enter date (day):- ");
    scanf("%d", &d);

    printf("Enter month (1-12):- ");
    scanf("%d", &m);

    if(m==12&&d>=22||m==1&&d<=19)
        printf("\nCapricon");
    else if(m==1&&d>=20||m==2&&d<=17)
        printf("\nAquarius");
    else if(m==2&&d>=18||m==3&&d<=19)
        printf("\nPisces");
    else if(m==3&&d>=20||m==4&&d<=19)
        printf("\nAries");
    else if(m==4&&d>=20||m==5&&d<=20)
        printf("\nTaurus");
    else if(m==5&&d>=21||m==6&&d<=20)
        printf("\nGemini");
    else if(m==6&&d>=21||m==7&&d<=22)
        printf("\nCancer");
    else if(m==7&&d>=23||m==8&&d<=22)
        printf("\nLeo");
    else if(m==8&&d>=23||m==9&&d<=22)
        printf("\nVirgo");
    else if(m==9&&d>=23||m==10&&d<=22)
        printf("\nLibra");
    else if(m==10&&d>=23||m==11&&d<=21)
        printf("\nScorpio");
    else if(m==11&&d>=20||m==12&&d<=17)
        printf("\nSagittarius");
    else
        printf("\nInvalid Input");

}

#c

C program to calculate BMI (Body Mass Index) and also display its category

#include<stdio.h>
void main()
{
    double h,w,bmi;

    printf("Enter weight in kg:- ");
    scanf("%lf", &w);

    printf("Enter height in m:- ");
    scanf("%lf", &h);

    bmi=w/(h*h); 

    printf("\nYour BMI is %lf", bmi);

    if(bmi<=15)
        printf("\nBMI Category:- Starvation\n");
    else if(bmi<=17.5)
        printf("\nBMI Category:- Anorexic\n");
    else if(bmi<=18.5)
        printf("\nBMI Category:- Underweight\n");
    else if(bmi<=24.9)
        printf("\nBMI Category:- Ideal\n");
    else if(bmi<=25.9)
        printf("\nBMI Category:- Overweight\n");
    else if(bmi<=39.9)
        printf("\nBMI Category:- Obese\n");
    else
        printf("\nBMI Category:- Morbidly Obese\n");
}

#c

How to add first 20 numbers without using any loop in C?

#include<stdio.h>
int main()
{
    int a=20,sum;

        sum=add(a);
        printf("%d", sum);

}
int add(int n)
{
    if(n==1)
            return 1;
        else
            return(n+add(n-1));
}

#c