1 solutions

  • 0
    @ 2025-11-5 15:15:26

    C :

    #include<stdio.h>
    #include<math.h>
    int main(){
    double a,b,c,s,L;
    scanf("%lf %lf %lf",&a,&b,&c);
    s=(a+b+c)/2;
    L=sqrt(s*(s-a)*(s-b)*(s-c));
    printf("%.2lf",L);
    return 0;
    }
    

    C++ :

    #include <stdio.h>
    #include <math.h>
    int main() {
    	float a, b, c, s, area;
    	scanf("%f %f %f", &a, &b, &c);
    	s = (a + b + c) * 0.5;
    	area = sqrt(s * (s - a) * (s - b) * (s - c));
    	printf("%.2f\n", area);
    	return 0;
    }
    
    

    Pascal :

    var
      a,b,c,d,s:double;
    begin
      readln(a,b,c);
      d:=(a+b+c)/2;
      s:=sqrt(d*(d-a)*(d-b)*(d-c));
      writeln(s:0:2);
    end.
    
    

    Java :

    import java.util.*;
    public class Main {
    	public static void main(String args[]) {
    		Scanner cin=new Scanner(System.in);
    		double a,b,c;
    		double p;
    		double hl;
    		a=cin.nextDouble();
    		b=cin.nextDouble();
    		c=cin.nextDouble();
    		p=(a+b+c)/2;
    		hl=Math.sqrt(p*(p-a)*(p-b)*(p-c));
    		System.out.printf("%.2f",hl);
    	}
    }
    

    Python :

    from math import sqrt
    a,b,c = [float(x) for x in raw_input().split()]
    p = (a+b+c)/2
    print "%.2f" %sqrt(p*(p-a)*(p-b)*(p-c))
    
    • 1

    Information

    ID
    16576
    Time
    1000ms
    Memory
    32MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By