Can anyone tell me why my C code can't compile:
Code:
#include <stdio.h>
#include <math.h>
#define PI = 3.1415926
int main()
{
int k;
double R, A, V, TR, TA, TV, R_av, A_av, V_av;
for (k = 1; k <= 15; k++) {
R=k/10;
A=4*PI*R*R;
V=A*R/3;
TA=TA+A;
TV=TV+V;
TR=TR+R;
printf ("Sphere ( %d)\t Radius = %d\t Area = %d\t Volume = %d\n", k, R, A, V)
;
R += 0.1;
}
}
This is the error it displays:
iacs5.ucsd.edu% cc hw2v2.c -o hw2
"hw2v2.c", line 11: whitespace between two character assignment operators
"hw2v2.c", line 11: left operand must be modifiable lvalue: op "*="
cc: acomp failed for hw2v2.c