I need to create a program in C that fills any number that the user types. I wrote this code, but it does not work fully because it calculates only once. I do not want a ready answer, I want an explanation, why that happens.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int num, i, j, cont=0, resp;
printf("digite um numero inteiro positivo:\n");
scanf("%i", &num);
for(i=1;i<10000;i++)
{
for(j=1;j<10000;j++)
{
if(i%j==0)
cont++;
if(cont==2)
{
resp=num/i;
printf("%i |%i=%i", num, i, resp);
}
}
if(resp==1)
break;
}
return 0;
}