7

void main() is not portable Although it "works" in a lot of cases, the only two portable definitions of main are: int main(void) and int main(int argc, char **argv) Error checking You don't check the return value of scanf. This would be better: if(scanf("%d", &n) != 1) { fputs("Error; enter a number.", stderr); return EXIT_FAILURE; /* ...


Only top voted, non community-wiki answers of a minimum length are eligible