Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  5.  
  6. int main() {
  7. while(1){
  8. int sposob_polaczenia = 0;
  9. int n1 = 0;
  10. int n2 = 0;
  11. printf("Podaj liczbe cewek: ");
  12. scanf("%d", &n1);
  13. printf("\nPodaj liczbe kondensatorow: ");
  14. scanf("%d", &n2);
  15. printf("Podaj sposob polaczenia:\n1 szeregowo\n2 rownolegle\n");
  16. scanf("%d", &sposob_polaczenia);
  17. if(n1 <= 0 || n2 <= 0 || sposob_polaczenia <= 0){
  18. printf("podaj prawidlowe liczby\n");
  19. }
  20. else{
  21. switch(sposob_polaczenia){
  22. case 1:
  23. if(n1==1 && n2==1){
  24. printf("czestotliwosc rezonansowa wynosi: f=1/(2*pi*sqrt(LC))\n");
  25. }
  26. else{
  27. printf("czestotliwosc rezonansowa wynosi: f=1/(2*pi*sqrt(%dL%dC))\n", n1, n2);
  28. }
  29. break;
  30. case 2:
  31. if(n1==1 && n2==1){
  32. printf("czestotliwosc rezonansowa wynosi: f=1/(2*pi*sqrt(LC))\n");
  33. }
  34. else{
  35. printf("czestotliwosc rezonansowa wynosi: f=1/(2*pi*sqrt((L/%d)(C/%d)))\n", n1, n2);
  36. }
  37. break;
  38. } }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement