// 08262009.cpp
// Peter H. Anderson, MSU, Aug 26, '09

#include <stdio.h>
#include <stdlib.h>

int main()
{
   int v, num, n;
   float r1, r2, req;
   float x, y;
   
   printf("Enter two resistor vals: ");
   scanf("%f %f", &r1, &r2);
   
   req = (r1 * r2) / (r1 + r2);
   
   printf("The para eq of %.2f and %.2f is %.2f\n", r1, r2, req);
   
   system("pause");

   printf("Enter an integer:"); // example of calculating factorial
   scanf("%d", &num);
   
   v = 1;
   for (n=1; n<=num; n++)
   {
      v = v * n;
   }
   printf("The factorial of %d is %d\n", num, v);
   
   system("pause");
   
   x = 21.27;  // We could scanf all of this stuff
   num = 6;  
   
   y = 1.0;
   
   for (n=1; n<=num; n++)
   {
       y = y * x;
   }
 
   printf("%.2f raised to the %i power is %.2f\n", x, num, y);
 
   system("pause");
   
} 

#ifdef OUTPUT

Enter two resistor vals: 1 2
The para eq of 1.00 and 2.00 is 0.67
Press any key to continue . . .
Enter an integer:4
The factorial of 4 is 24
Press any key to continue . . .
21.27 raised to the 6 power is 92598720.00
Press any key to continue . . .

#endif