Ask the user for a range of numbers The program then finds t
Ask the user for a range of numbers. The program then finds the numbers in the given range such that the number is divisible by all the numbers from 1 to 9.
Solution
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int low,high,flag=0;
cout<<\"Please enter the range : \ \";
cout<<\"Lower Bound :\";
cin>>low;
cout<<\"\ Upper Bound :\";
cin>>high;
for(int number=low;number<=high;number++)
{
for (int divisor=1; divisor<=9; divisor++)
{
if (number%divisor == 0)
{
flag=1;
}
else
{
flag=0;
break;
}
}
if(flag==1)
{
cout<<number<<\" \";
}
}
return 0;
}
