刚学c语言,写了个程序,运行结果不对,求解下
下面是求2或3阶的行列式的程序,但是输入2或3就输出your number is too large.指教请
#include "stdio.h"
void main()
{
float a,b,c,d,e,f,g,h,i,n,z;
printf("please type the amount of hls.\n");
scanf("%d",&n);
if (n==1)
{
printf("your number is wrong,please type again.\n");
}
else
{
if (n==2)
{
printf("please type the 4 number of the hls.\n");
scanf("%f,%f,%f,%f",&a,&b,&c,&d);
z=a*c-b*d;
printf("the result is %f,\n",z);
}
else
{
if (n==3)
{
printf("please type the 4 number of the hls.\n");
scanf("%f,%f,%f,%f,%f,%f,%f,%f,%f",&a,&b,&c,&d,&e,&f,&g,&h,&i);
n=a*e*i-a*f*h+a*d*i-b*g*f+c*d*h-c*g*e;
printf("the result is %f,\n",z);
}
else
{
printf("your number is too large.\n");
}
}
}
}