Advertisement
Vankata17

triangle in c

Mar 7th, 2022
985
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include <math.h>
  4. int calculate(double a,double b, double c, double* p, double* s){
  5.     *p =  a+b+c;
  6.     *s = sqrt(*p/2 *(*p/2 -a)*(*p/2 -b)*(*p/2 - c));
  7. return 0;
  8. }
  9. int main(){
  10. double a = 20;
  11. double b = 10;
  12. double c = 10;
  13. double p = 0.0;
  14. double s = 0.0;
  15. calculate(a,b,c,&p,&s);
  16. printf("%lf",p);
  17. printf("%lf",s);
  18.  
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement