Ohm's law in C program?
We were given the task of creating a C program (I'm using onlinegdb.com) that displays the correct values when run. Given the values of 33V and the resistors:
R1=blue yellow red silver
R2=purple white orange gold
R3=red red red silver
R4=grey white red gold
R5=red green brown silver
R6=yellow orange brown gold
R7=brown black black silver
R7=red blue brown gold
We're supposed to write C code that displays the results when you click "Run," but I have no idea what kind of code to write because I don't know anything about C or programming languages, and we haven't been told how to proceed.
This is what the circuit looks like:
PS: I have reposted this question with more details.
Hello
pretty heavy task for the first time with C
First you need to determine the resistance values based on their color codes. Then you can use the Ohm Law to calculate the current through any resistance when a voltage of 33V is applied.
In the code, you need to define the color coding first. After that, you can write a function that calculates the balance and gives you the value back. It’s as if you’re programming a TR.
If you can’t get any further, I’ll try to help you, but I’d have to think about it.
Thank you for your answer. I find it unfair that this is already required in my first training week (IT-SE). I have no plan of C or programming languages in general. I can’t imagine it’s too hard for you, because we’re only at the beginning.
I already know how to carry out the invoices, so how to do it. the resistance values, but I don’t have a plan to write the whole thing as a C code. I’ve also been researching on the Internet whether there were similar tasks, but I didn’t really find it.
Do it cool if you or anyone could help me because I have no plan of C and all the orders. I only know that we should use commands such as “” etc.
got it and tested. Works perfectly. Don’t know how exactly I can explain this to you
Nice, thanks.
I have sent you
You can give me the code. Maybe I can learn from it.
So…
First you need variabels…
So type and then the name you want to forgive. Float, by the way. Variabel search guys.
https://learn.microsoft.com/de-de/visualstudio/get-started/csharp/tutorial-console?view=vs-2022
Since I find the task quite difficult, I’ve been dealing with it too. The determination of the resistance values from the color code is not suitable for beginners.