Following is the program to convert Rupees to Dollars and Vice versa:-
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int code;
float r,d,t;
clrscr();
printf("enter your code \n 1.rupees to dollar\n 2.dollar to rupee\n");
scanf("%d",&code);
if(code==1)
{
printf("enter amount");
scanf("%f",&r);
d=r/(60);
printf("you have dollar %f",d);
}
else if (code==2)
{
printf("enter your amount ");
scanf("%f",&d);
r=d*(60);
printf("you have rupees %f",r);
}
else
printf("invalid code");
getch();
}
Output:-
Note- using the same logic we can design this program in C++ too
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int code;
float r,d,t;
clrscr();
printf("enter your code \n 1.rupees to dollar\n 2.dollar to rupee\n");
scanf("%d",&code);
if(code==1)
{
printf("enter amount");
scanf("%f",&r);
d=r/(60);
printf("you have dollar %f",d);
}
else if (code==2)
{
printf("enter your amount ");
scanf("%f",&d);
r=d*(60);
printf("you have rupees %f",r);
}
else
printf("invalid code");
getch();
}
Output:-
Note- using the same logic we can design this program in C++ too
I personally use them exclusively high-quality elements : you will notice these folks during: translate currency
ReplyDelete