Advertisement
LightningStalker

tankfreq.c

Jul 4th, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.61 KB | None | 0 0
  1. /* Compile with gcc -Wall -o tankfreq tankfreq.c -lm */
  2.  
  3. #include <math.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6.  
  7. int main (int argc, char **argv)
  8. {
  9.     if (argc == 3)
  10.     {
  11.         printf ("%f\n", 1 / (3.14159265359 * 2 * sqrt (atof(argv[1]) /
  12.             1000000 * atof(argv[2]) / 1000000)));
  13.         return (1);
  14.     }
  15.     else
  16.     puts ("tankfreq is an LC tank resonance frequency calculator.");
  17.     puts ("output is frequency in Hz\n");
  18.     puts ("Usage: tankfreq microfarads microhenries");
  19.     puts ("Example: tankfreq 3.3 .86207");
  20.     puts ("Output should be: 94360.861167");
  21.     return (0);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement