Skip to main content

Currency Converter - USD & BDT [C Programming]

#include <stdio.h>
void main()
{
    int i;
    float usd, bdt;
    printf("Press 1 to convert USD to BDT\nPress 2 to convert BDT to USD\n");
    printf("Enter your choice: ");
    scanf("%d", &i);
    switch(i)
    {
        case 1:
            printf("Enter amount in USD: ");
            scanf("%f", &usd);
            bdt = usd * 80;
            printf("1 USD = 80 BDT\n");
            printf("%0.3f USD = %0.3f BDT", usd, bdt);
            break;
        case 2:
            printf("Enter amount in BDT: ");
            scanf("%f", &bdt);
            usd = bdt * 0.0125;
            printf("1 BDT = 0.0125 USD\n");
            printf("%0.3f BDT = %0.3f USD", bdt, usd);
            break;
        default:
            printf("Wrong Choice!");
    }
}

Comments

  1. I really appreciate this wonderful post that you have provided for us. I assure this would be beneficial for most of the people. 50 cad to usd

    ReplyDelete

Post a Comment

Popular posts from this blog

Take Integer, Float, Character as Input & Print Them in Console [C Programming]

#include <stdio.h> void main() {     char ch;     int i;     float f;     printf("Enter a character: ");     scanf("%c", &ch);     printf("Enter an integer: ");     scanf("%d", &i);     printf("Enter a fraction number: ");     scanf("%f", &f);     printf("Character: %c\nInteger: %d\nFloat: %f", ch, i, f); }