C Program to convert one Currency in another - My CS Tutorial - My CS Tutorial

Breaking

Programming languages full tutorial and programs, exam papers, visual basic( Vb.net ), information of new technologies and more....

Saturday, January 4, 2020

C Program to convert one Currency in another - My CS Tutorial

C program to convert currency as Dollar to Rupee and Rupee to Dollar in one program.
In this post we will learn how to write a c program that convert a value of currency in another currency.
This is a program of currency convertor.


Program Description:

Here we will write a c program that solve both operations as Dollar to Rupee and Rupee to Dollar in one program.
This program provides a choice to user that which operation will be execute.

In this program, Choice 1 is ENTER 1 FOR CURRENCY CONVERTION FROM RUPEE TO DOLLAR.
Choice 2 is ENTER 2 FOR CURRENCY CONVERTION FROM DOLLAR TO RUPEE.

C program code


#include<stdio.h>
#include<conio.h>
void main()
{
 int choice;
 float rupee,dollar;
 clrscr();
 printf("\n ENTER 1 FOR CURRENCY CONVERTION FROM RUPEE TO DOLLAR\n ");
  printf("\n ENTER 2 FOR CURRENCY CONVERTION FROM DOLLAR TO RUPEE\n ");
 scanf("%d",&choice);
   switch(choice)
   {
    case  1:
               printf("\n ENTER AMOUNT IN RUPEES:\n ");
     scanf("%f",&rupee);
     dollar=(rupee*0.014);
     printf("\n %.2f INR = %f $\n",rupee,dollar);
     break;
     
    case 2:
               printf("\n ENTER AMOUNT IN DOLLAR:\n ");
     scanf("%f",&dollar);
     rupee=(dollar*71.76);
     printf("\n %.2f $ = %f INR\n",dollar,rupee);
     break;
   
   default:
                   printf("\n WRONG ENTRY.");
   }
   getch();
}


OUTPUT:




C program to convert Dollar to Rupee and vice versa.

C program to convert  Rupee to Dollar and vice versa.

In this output we can see that it is a Currency converter.
This program provides a choice to user that which operation will be execute.
if we will enter 1 then it converts Currency from Rupee to Dollar if we will enter 2 then it converts Dollar to Rupee.

If we will enter any other number from 1 or 2 then it is print WRONG ENTRY.


Please share this post and blog link with your friends.For more programs use this blog.
If you have any problem, please comment in comment box, subscribe this blog for notifications of new post on your email and follow this blog.If you have any method of this program or want to give any suggestion send email on hc78326@gmail.com

Created by-- HARSH CHAUHAN

No comments:

Post a Comment