What if the number is 2? Then there is only one divisor. How do you display 3 divisors?
Also, why do you need an infinite loop since numbers are not infinitely large? You only need a loop from 1 to n/2.
You could write it like this (this one displays all the divisors - not just three...):
https://onlinegdb.com/YJPVoIzyW3
#include <stdio.h>
#include <stdlib.h>
int main(int argc,char *argv[]) {
if (argc==1) return 1;
int n=atoi(argv[1]);
for (int i=1;i<=n/2;i++)
if (!(n%i))
printf("%d\n",i);
return 0;
}