Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- /* function declaration & definition */
- void parallel(int r1,int r2,int rS) {
- /* foo */
- }
- /* fucntion declaration & definition */
- void series(int r1,int r2,int rS) {
- /* foo */
- }
- void main () {
- 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;
- }
- mode = getche();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement