So my code runs but the problem is that the radius is always 0! Not sure what the problem is tried changing it to double and int and still won't work any help would be appreciated! I have attached the source codes below for you guys to see Btw boss.c is my header the calling program and iff.h is my source code.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <graph.h>
#include <math.h>
#include "screen.h"
#include "iffs.h"
int main()
{
ClearTheScreen();
PauseTheScreen();
Heading();
TriangleArea(10,20,2,5,7);
VolumeOfSphere(12,20,5);
VolumeOfCone(14,20,8,10);
Footer();
}
Code:
void TriangleArea(int row, int col, double a, double b, double c)
{
double Area;
_settextposition(row,col);
Area = a + b + c / 2;
Area = Area * (Area - a) * (Area - b) * (Area - c);
Area = sqrt(Area);
printf("The area of a triangle with sides 2, 5, 7 = %.3f",Area);
}
void VolumeOfSphere(int row, int col, int sun)
{
int Volume;
_settextposition(row,col);
Volume = 4/3 * 3.14159 * sun * sun * sun;
printf("Volume of sphere with radius %2d = %2d", sun, Volume);
}
void VolumeOfCone(int row, int col, int star, int moon)
{
int Volume;
_settextposition(row,col);
Volume = (1/3) * 3.14159 * star * star * moon;
printf("Volume of cone with radius %d height %d = %d",Volume,star,moon);
}