getting wrong answer

#include<stdio.h>
int main()
{
int n,i,z;
double k;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("d",&z); for(k=1;z;z--) k=k*z; printf(".f\n",k);
}
return 0;
}

Use Brasis for the second for loop as well

First thing, to put their curly brackets in the second for loop and
second thing, it can be a problem in the test condition of the second for loop, i.e., for(k=1; z; z–).
If you are sure that the test condition of the for loop is correct, then please reply with the reason.
Because, here you have not initialised z in the for loop.

First thing, to put their curly brackets in the second for loop and second thing, it can be a problem in the test condition of the second for loop, i.e., for(k=1; z; z–). If you are sure that the test condition of the for loop is correct, then please reply with the reason. Because, here you have not initialised z in the for loop.

value of z will be obtained from user using scanf function