Blame c/console/expressions/expressions.c

Ivan Mahonin 7d6e8e
#include <stdio.h>
Ivan Mahonin 7d6e8e
#include <math.h>
Ivan Mahonin 7d6e8e
Ivan Mahonin 7d6e8e
int main() {
Ivan Mahonin 7d6e8e
  float a = 10.f, b = 15.f, c = 20.f;
Ivan Mahonin 7d6e8e
  float result;
Ivan Mahonin 7d6e8e
Ivan Mahonin 7d6e8e
  result = (1.f/4.f)*sqrtf((a+b+c)*(b+c-a)*(a+c-b)*(a+b-c));
Ivan Mahonin 7d6e8e
  printf( "Area of triangle with sides %f, %f and %f is %f\n",
Ivan Mahonin 7d6e8e
          a, b, c, result );
Ivan Mahonin 7d6e8e
Ivan Mahonin 7d6e8e
  result = (1.f/3.f)*M_PI*a*(b*b);
Ivan Mahonin 7d6e8e
  printf( "Volume of cone with height %f and radius %f is %f\n",
Ivan Mahonin 7d6e8e
          a, b, result );
Ivan Mahonin 7d6e8e
Ivan Mahonin 7d6e8e
  result = (4.f/3.f)*M_PI*a*b*c;
Ivan Mahonin 7d6e8e
  printf( "Volume of ellipsoid with radiuses %f, %f and %f is %f\n",
Ivan Mahonin 7d6e8e
          a, b, c, result );
Ivan Mahonin 7d6e8e
Ivan Mahonin 7d6e8e
  return 0;
Ivan Mahonin 7d6e8e
}