How to write a program using C for currency converter? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to write a program using C for currency converter?

Like rupee to dollar, pounds, yen, euro and vice versa.

20th Apr 2018, 11:05 AM
Anubhav Aryan
2 Answers
0
just simply take an integer of float variable as an input and the just multiply it by a number that is equivalent to the original one. For example 1 dollar ≈ 64 INR So when you just need to multiply the original value to (1/64.0) And same applies for the rest.
20th Apr 2018, 11:40 AM
RZK 022
RZK 022 - avatar
- 1
#define YOUR_CURRENCY DOLLAR_EXCHANGE_RATE money_t euro_to_yen(money_t amount) { return amount * YEN / EURO; } #undef YOUR_CURRENCY
20th Apr 2018, 1:47 PM
Timon Paßlick