IN C PROGRAMMING LANGUAGE         A resistor is a circuit device designed to have a specific resistance value between its ends. Resistance values are expressed in ohms (Ω) or kilo-ohms (kΩ). Resistors are frequently marked with colored bands that encode their resistance values, as shown in the Figure. The first two bands are digits, and the third is a power-of-ten multiplier.     The Table below shows the meanings of each band color. For example, if the first band is green, the second is black, and the third is orange, the resistor has a value of 50 × 103 Ω or 50 k Ω. The information in the Table can be stored in a C program as an array of strings. char COLOR_CODES[10][7] = {"black", "brown", "red", "orange", "yellow", "green", "blue", "violet", "gray", "white"}; Notice that “red” is COLOR_CODES[2] and has a digit value of 2 and a multiplier value of 102. In general, COLOR_CODES[n] has digit value n and multiplier value 10n. Write a program that prompts for the colors of Band1, Band2, and Band3, and then displays the resistance in kilo-ohms

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 27PE
icon
Related questions
Question

IN C PROGRAMMING LANGUAGE 

 

  1.  
 
 
  • A resistor is a circuit device designed to have a specific resistance value between its ends. Resistance values are expressed in ohms (Ω) or kilo-ohms (kΩ). Resistors are frequently marked with colored bands that encode their resistance values, as shown in the Figure. The first two bands are digits, and the third is a power-of-ten multiplier.

 

 

The Table below shows the meanings of each band color. For example, if the first band is green, the second is black, and the third is orange, the resistor has a value of 50 × 103 Ω or 50 k Ω. The information in the Table can be stored in a C program as an array of strings.

char COLOR_CODES[10][7] = {"black", "brown", "red", "orange", "yellow", "green", "blue", "violet", "gray", "white"};

Notice that “red” is COLOR_CODES[2] and has a digit value of 2 and a multiplier value of 102. In general, COLOR_CODES[n] has digit value n and multiplier value 10n.

Write a program that prompts for the colors of Band1, Band2, and Band3, and then displays the resistance in kilo-ohms.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage