We help IT Professionals succeed at work.

Statements vs equations

alwright1975 asked
Last Modified: 2010-08-05
I am haveing a problem. I am supose to use hard coded equations  to get this results.

Currency Conversion
1.00 Euro = 1.28 US Dollar
1.00 UK Pound = 1.87 US Dollar
1.00 Japanese Yen = 0.01 US Dollar
1.00 Canadian Dollar = 0.82 US Dollar
1.00 Australian Dollar = 0.77 US Dollar

I got the above display with this...

#include <studio.h>


//Title of program
printf("Currency Conversion\n");
//List of Conversions
printf("1.00 Euro = 1.28 US Dollar\n");
printf("1.00 UK Pound = 1.87 US Dollar\n");
printf("1.00 Japanese Yen = 1.01 US Dollar\n");
printf("1.00 Canadian Dollar = 0.82 US Dollar\n");
printf("1.00 Australian Dollar = 0.77 US Dollar\n");


but they are not equations...how can I convert these statments to equations?
Watch Question

Are you trying to make program which will convert currencies?


yes, my fist step is to use hard coded equations to display what i showed above. Then I have to build on it to write one with a menu to chose which converstion, then to allow user to enter amount to convert and I am lost and confused?
Unlock this solution and get a sample of our free trial.
(No credit card required)
This program:

- Prints the menu.
- Reads the choice to the variable "choice".
- Depending of what did user choose, we have different coefficients.
- Reads the amount of money.
- Multiplies the amount of money with coefficient.
- Prints the result.


* '\n' - new line
* '\t' - tab
* when you want to read some variable you must use & in front of it.
* when you want to print it you don't use &.
* when you want to read or print double variable you must use %lf in printf or scanf.
Top Expert 2009

UrosVidojevic, please don't just give code that is meant for an assignment. The goal for alwright1975 is to learn something - not to just get a solution handed on a platter.

alwright1975, what you want to do is store the conversion values in some variables (an array would be nice). Then, you can retrieve those values, and use them to show the conversion rates to the user.

Take a look at the reference page for printf eg. :


Note that there are several format specifiers you can use to show variables. Take a look at the example code on that page too.


Thank you both, Infinity08 and UrosVidojevic all was very helpful. Also even thought it was great code I still have to tweak it to fit the requirment for my 3 assignments. This gave me an idea of how it works and what I needed to do to change it to the requirment. Thank you both again very much!!!!

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.