Displaying Numbers divisible by user's desired number
well...I was doing a program to ask the user from the range he wants the program to generate numbers from and also ask the user for a number and then generates all the numbers divisible by this number I did this so far but not working well...its always in a never-ending loop...Any Help?? Suggestion??
Code:
Code:
#include <stdio.h>
int main()
{
int x,ul,ll,j=0;
printf("Please enter your desired number you want its divisible numbers\n");
scanf("%i",&x);
printf("Please enter the lower limit you desire\n");
scanf("%i",&ll); //ALERT: getchar(); --> its only with characters!
printf("Please enter the upper limit you desire\n");
scanf("%i",&ul);
for (j <= ll; j <= ul; j++)
{
if (x < j)
{
if (j % x == 0)
{
printf("\t%i\t", x);
j++;
}
}
else
{ if ( j == x)
{
j = 0;
printf("\n");
}
}
}
return (0);
}