N
notahipee
Would someone be able to tell me why this isn't working. The nested
for loops seem correctly coded to me. I would appreciate any input.
#include <iostream.h>
#include <math.h>
int main ()
{
int a, b, c, d;
cout << "Enter two integers ";
cin >> a >> b;
for (c=a; c==b; c++)
{
for(d=2; d<=sqrt(c); d++)
{
if(c%d==0)
continue;
else cout << c;
}
}
cout << " are the prime numbers in the range " << a << " to " << b <<
endl;
return 0;
}
for loops seem correctly coded to me. I would appreciate any input.
#include <iostream.h>
#include <math.h>
int main ()
{
int a, b, c, d;
cout << "Enter two integers ";
cin >> a >> b;
for (c=a; c==b; c++)
{
for(d=2; d<=sqrt(c); d++)
{
if(c%d==0)
continue;
else cout << c;
}
}
cout << " are the prime numbers in the range " << a << " to " << b <<
endl;
return 0;
}