Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- //#include <conio.h>
- void main () {
- void parallel (float rT);
- void series (int rT);
- char mode;
- int r1,r2,rS; /*Get all the values we need */
- printf("Input resistor value 1\n");
- scanf("%u",r1);
- printf("Input resistor value 2\n");
- scanf("%u",r2);
- rS = r1 + r2;
- printf("Press 1 for parallel resistors\n\nPress 2 for serial resistors\n"); /*Ask for mode*/
- switch (mode) {
- case 1:
- parallel(r1,r2,rS);
- printf("Total resistance is %.2f\n",&rT);
- break;
- case 2:
- series(r1,r2,rS);
- printf("Total resistance is %u\n",&rT);
- break;
- }
- parallel(float rT) {
- int rM;
- float rT;
- rM = r1 * r2;
- rT = rM / rS;
- }
- series(int rT) {
- /* blah */
- rT=rS;
- }
- mode=getche();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement