C Programming – Currency Converter
Essay Preview: C Programming – Currency Converter
Report this essay
#include
#include
main()
int choice;
float amt;
float result;
getch();
printf(“nn ****Choose the currency you are using**** nPush 1 for Dollars. nPush 2 for Pounds. nPush 3 for Naira. nPush 4 for Cedies. nPush 5 for Yen. nPush 6 for Yuan Renminbi.n”, &choice);

scanf(“%d”,&choice);
if (choice == 1){
float usd[5] = {162.200,1.63700,77.9459,0.639420,6.31880};
scanf(“%f”,&amt);
printf(” ******_To Convert To_****** nNaira Push 1. nCedies Push 2. nYen(Japan) Push 3. nPounds Push 4. nYuan Renminbi Push 5.”,&choice);

getch();
scanf(“%d”,&choice);
if (choice == 1){
result= amt*usd[0];
printf(“Your Result is %f “,&result);
}
else if (choice == 2){
result=amt*usd[1];
printf(“Your Result is %f “,&result);
}
else if (choice == 3){
result=amt*usd[2];
printf(“Your Result is %f “,&result);
}
else if (choice == 4){
result = amt*usd[3];
printf(“Your Result is %f “,&result);
}
else if (choice == 5){
result = amt*usd[4];
printf(“Your Result is %f “,&result);
}
else if (choice == 6){
result = amt*usd[5];
printf(“Your Result is %f “,&result);
}
else {
getch();
}
}
else if (choice == 2){
float gbp[5] = {253.528,2.55911,121.896,1.56392,9.88171};
scanf(“%f”,&amt);
printf(” ******_To Convert To_****** nNaira Push 1. nCedies Push 2. nYen(japan) Push 3. nDollars Push 4. nYuan Renminbi(China) Push 5.”,&choice);

getch();
scanf(“%d”,&choice);
if (choice == 1){
result= amt*gbp[0];
printf(“Your Result is %f “,&result);
}
else if (choice == 2){
result=amt*gbp[1];
printf(“Your Result is %f “,&result);
}
else if (choice == 3){
result=amt*gbp[2];
printf(“Your Result is %f “,&result);
}
else if (choice == 4){
result = amt*gbp[3];
printf(“Your Result is %f “,&result);
}
else if (choice == 5){
result = amt*gbp[4];
printf(“Your Result is %f “,&result);
}
else if (choice == 6){
result = amt*gbp[5];
printf(“Your Result is %f “,&result);
}
else {
getch();
}
}
else if (choice == 3){
float ngn[5] = {0.00616523,0.0100925,0.480470,0.00394434,0.0389568};
printf(” ******Please type in your amount

Get Your Essay

Cite this page

Currency Converter And Float Result. (June 8, 2021). Retrieved from https://www.freeessays.education/currency-converter-and-float-result-essay/