Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int main() {
- while(1){
- int sposob_polaczenia = 0;
- int n1 = 0;
- int n2 = 0;
- printf("Podaj liczbe cewek: ");
- scanf("%d", &n1);
- printf("\nPodaj liczbe kondensatorow: ");
- scanf("%d", &n2);
- printf("Podaj sposob polaczenia:\n1 szeregowo\n2 rownolegle\n");
- scanf("%d", &sposob_polaczenia);
- if(n1 <= 0 || n2 <= 0 || sposob_polaczenia <= 0){
- printf("podaj prawidlowe liczby\n");
- }
- else{
- switch(sposob_polaczenia){
- case 1:
- if(n1==1 && n2==1){
- printf("czestotliwosc rezonansowa wynosi: f=1/(2*pi*sqrt(LC))\n");
- }
- else{
- printf("czestotliwosc rezonansowa wynosi: f=1/(2*pi*sqrt(%dL%dC))\n", n1, n2);
- }
- break;
- case 2:
- if(n1==1 && n2==1){
- printf("czestotliwosc rezonansowa wynosi: f=1/(2*pi*sqrt(LC))\n");
- }
- else{
- printf("czestotliwosc rezonansowa wynosi: f=1/(2*pi*sqrt((L/%d)(C/%d)))\n", n1, n2);
- }
- break;
- } }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement