Dear all,
I am writing a simple program that performs some statistical calculations. The code looks like:
This code doesn't work well, because the variable f_A is not computed. In other words, the code fails to calculate correctly f_A.Code:#include <stdio.h> #include <math.h> int x, n; float f_A; float chi2 = 0; int genotype[4]; float expected[4]; int main(void) { // code here n = genotype[1]+genotype[2]+genotype[3]; f_A = ((2*genotype[1])+(genotype[2]))/(n*2); // code here return 0; }
If I, nevertheless, replace the formula
f_A = ((2*genotype[1])+(genotype[2]))/(n*2);
to
f_A = ((2*genotype[1])+(genotype[2]));
f_A = f_A/(n*2);
the code gives correct results.
Am I missing some very basic information about C programming?
Thank you for any tips.
cheers!
Tiago



LinkBack URL
About LinkBacks



