Resistor Value Calculator

resistor-5When designing electronic circuits you may need to use resistors. Each resistor has a resistance value expressed in ohms (Ω). Resistors are identified by a series of concentric coloured bands. Each band colour has a value which is used to calculate the resistance value of the resistor.

Here is how the resistor colour code works:
Resistor-Color-Bands

Resistor-Color-Codes

You can check the resistance value of a resistor online using an online calculator.

Your Challenge


Your challenge consists of writing a program that asks the user to enter three colours (e.g. Red, Red, Green) and returns the resistance value (e.g. 2,200,000 Ω or 2,200 kΩ).

Test your code


Test your code to find the resistance value of the following three resistors:

Resistor1

Resistor2

Resistor3

Challenge #2: The other way round


Create a computer program that asks the user for a resistor value in ohms and returns the three colours matching this value.
unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 4

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: ,