Advertisement
HristoBaychev

DefPI

Oct 6th, 2021
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1. /*Задача 16. Да се дефинира константата Пи (3.14159...) и да се напише
  2. функция, която изчислява лицето на окръжност по даден радиус (Пи * R * R).
  3. В main() да се извика горната функция с радиуси 1, 1.5, 13.*/
  4.  
  5. #include <stdio.h>
  6.  
  7. double cVerPi(double r){
  8.     const double PAI = 3.14159;
  9.     double sum = 0;
  10.     sum = PAI*r*r;
  11.     printf ("\n%f", sum);
  12.     return sum;
  13. }
  14.  
  15. int main() {
  16.     cVerPi(1);
  17.     cVerPi(1.5);
  18.     cVerPi(13);
  19.     return 0;
  20.    
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement