怎么保留成6位有效数字

#include "stdio.h"
#include "math.h"
int main()
{
float a, b, c;
float s;
float p;
scanf("%f", &a);
scanf("%f", &b);
scanf("%f", &c);

p = (a + b + c) / 2;
s = sqrt(p*(p - a)*(p - b)*(p - c));    //海伦公式
printf("%.2f", s);

}

把2f改成6f就行了

#include "stdio.h"
#include "math.h"
int main()
{
float a, b, c;
float s;
float p;
scanf("%f", &a);
scanf("%f", &b);
scanf("%f", &c);
p = (a + b + c) / 2;
s = sqrt(p*(p - a)*(p - b)*(p - c));    //海伦公式
printf("%.6f", s);
}

希望对你有用,望采纳

img