Question
Write a program to illustrate the Ohms Law, I=V/R. The program will first request to input an initial voltage (in volt), a fixed resistance (in
Write a program to illustrate the Ohms Law, I=V/R. The program will first request to input an initial voltage (in volt), a fixed resistance (in ohm) and an incremental interval for voltage. A function should be written which will return the value of current (in amp) given a voltage and a resistance. Then the program will call the function and print out a table that shows the value of current under each increment of voltage. The maximum voltage is set to 50 volts. a) Main should handle all input and output.(This requires that variables in main are updated by the function.)
b) Secondary function should handle all calculations.
c) Set precision to 2. Output Example: Enter the initial voltage (in volt): 40
Enter the resistance (in ohm): 10
Enter the voltage incremental interval (in volt): 2
Voltage (volt) Resistance (ohm) Current (amp)
------------- ---------------- -------------
40 10 4.00
42 10 4.20
44 10 4.40
46 10 4.60
48 10 4.80
50 10 5.00
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started