I've been looking online but am having trouble finding sources on using C for basic multiplication. I'm assuming this is not the original purpose of C, but its what I need to do.
If anyone can see glaring errors i'm making please let me know!
I've tried declaring my variables as both doubles and int 's but to no avail.
I updated my code but its still not working. The specific error i am getting is:
: In function 'main':
:36: error: expected ')' before ';' token
:37: error: expected ')' before ';' token
:39: error: expected ')' before ';' token
If anyone can see glaring errors i'm making please let me know!
I've tried declaring my variables as both doubles and int 's but to no avail.
Code:
#include <stdio.h>
#include <math.h>
int main()
{
/* the given dimensions of the tank in meters*/
#define DIAMETER 5.0;
#define HEIGHT 10.0;
/* conversion factors*/
#define M2F 3.2808
#define F2G 7.481
/* Declare my variables*/
int DIAMETER_FEET,HEIGHT_FEET,VOLUME_FEET,VOLUME;
/* define my variables*/
&DIAMETER_FEET = DIAMETER * M2F;
&HEIGHT_FEET = HEIGHT * M2F;
&VOLUME_FEET = DIAMETER_FEET * HEIGHT_FEET;
&VOLUME = VOLUME_FEET * F2G;
/* output statement*/
printf(VOLUME);
return 0;
}
I updated my code but its still not working. The specific error i am getting is:
: In function 'main':
:36: error: expected ')' before ';' token
:37: error: expected ')' before ';' token
:39: error: expected ')' before ';' token
Code:
#include <stdio.h>
#include <math.h>
int main()
{
/* Declare my variables*/
double DIAMETER_FEET,HEIGHT_FEET,VOLUME_FEET,VOLUME;
/* the given dimensions of the tank in meters*/
#define DIAMETER 5.0;
#define HEIGHT 10.0;
/* conversion factors*/
#define M2F 3.2808;
#define F2G 7.481;
/* define my variables*/
DIAMETER_FEET = (DIAMETER * M2F);
HEIGHT_FEET = (HEIGHT * M2F);
VOLUME_FEET = (DIAMETER_FEET * HEIGHT_FEET);
VOLUME = (VOLUME_FEET * F2G);
/* output statement*/
printf("%f", VOLUME);
return 0;
}
Comment