Let consider the conversion rate of US Dollar and Taka are 1 dollar = 80.45 taka. Write a program that first takes the choice from the user what conversion (hint 1 for dollar to taka or 2 for taka to dollar) he/she wants. Then an amount is given as input. Convert the amount and output the result according to the given choice.



#include<stdio.h>
void main ()
{
      int a;
      float b;
      printf("press 1 for dollar to taka\n\n press 2 for taka to dollar\n\n");
      scanf("%d", &a);
     
    switch(a)
      {
      case 1:
            printf("enter value: ");
            scanf("%f", &b);
            printf("%.2f taka\n", b*88.45);
            break;
      case 2:
            printf("enter value: ");
            scanf("%f", &b);
            printf("%.2f dollar\n", b/88.45);
            break;
      }


}

Comments