I already did that
int n;
int I;
cout <<"enter the value of n : ";
cin>>n;
cout <<"all the numbers between 1 and N that are divisible by 5 and 13 are:";
for (i=1 ; i <=n ; i++)
{
if (n%5==0 && n%13==0);
{
cout>>i;
}
}
return 0;
}
but it doesn't work
There are multiple problems with your code, but they are just minor things. This is where the main issue is.
The problem is is that you're checking the remainder of n. If the user enters 10, n will be set as 10, but 10 isn't evenly divisible by 13, so nothing will print.
Now, let's say the user enters 65. n is set to 65 and 65 evenly divides 5 and 13, so it will print out i. But what is i in this case? It's the numbers between 1 and n, inclusive. Thus, it will print out the numbers between 1 and n.
See if you can figure out what's wrong. It's something so simple you'll want to kick yourself. Good luck! :)