Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. /* function declaration & definition */
  5. void parallel(int r1,int r2,int rS) {
  6.     /* foo */
  7. }
  8.  
  9. /* fucntion declaration & definition */
  10. void series(int r1,int r2,int rS) {
  11.     /* foo */
  12. }
  13.  
  14.  
  15. void main () {
  16.  
  17.     char mode;
  18.     int r1,r2,rS; /*Get all the values we need */
  19.     printf("Input resistor value 1\n");
  20.     scanf("%u",r1);
  21.     printf("Input resistor value 2\n");
  22.     scanf("%u",r2);
  23.     rS = r1 + r2;
  24.     printf("Press 1 for parallel resistors\n\nPress 2 for serial resistors\n"); /*Ask for mode*/
  25.         switch (mode) {
  26.             case 1:
  27.                 parallel(r1,r2,rS);
  28.                 printf("Total resistance is %.2f\n",&rT);  
  29.             break;
  30.             case 2:
  31.                 series(r1,r2,rS);
  32.                 printf("Total resistance is %u\n",&rT);
  33.             break;
  34.         }          
  35.  
  36.     mode = getche();
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement