RenHao

e-Tutor_5

Sep 21st, 2015
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4. #define PI 3.1415926
  5. double CircusAreaCalc(double r)
  6. {
  7.     return pow(r, 2) * PI;
  8. }
  9. int main(int argc, const char * argv[])
  10. {
  11.     double AreaSum = 0.0 , Radius = 0.0;
  12.     char input[100];
  13.    
  14.     while(1)
  15.     {
  16.         scanf("%s",input);
  17.         Radius = atof(input);
  18.         if(Radius == 0)
  19.         {
  20.             printf("%.5f\n",AreaSum);
  21.             return 0;
  22.         }
  23.         AreaSum += CircusAreaCalc(Radius);
  24.     }
  25.    
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment