Refuses the entry if the user enters a float and keeps asking the user to enter an integer until the user responds properly and enters an integer.
i make this program but i don't know how to make the right way if there is better way will be great
include<stdio.h>
#include<stdlib.h>
int main()
{
int a;
int b;
int f=1;
printf("Enter integer: ");
scanf("%d\n",&a);
while(scanf("%d",&a)==0)
{
printf("Try again (Please enter an integer)\n");
}
for (b=1;b<=a;b++)
{
f*=b;
}
printf("The factorial of %d = %d\n",a,f);
return 0;
}