During execution, the algorithm just shuts down (I looked through debug). Condition: The algorithm belongs to the numerical segment [A;B] (1<A<B<1000000) outputs numbers that have exactly three different natural odd divisors among the divisors, not counting 1 and the number itself (if it is odd). For each found number, it outputs in 1 line separated by a space : the number itself and 3 odd divisors. Example: 30 3 5 15 , 42 3 7 21 , 54 3 9 27 , 60 3 5 15 , 66 3 11 33
My code:
#include <iostream>
using namespace std;
int main()
{
int A,B,g,j,i,c,chislo1,chislo2,chislo3,counter1;
A=30;
B=68;
counter1=0;
chislo1=0;
chislo2=0;
chislo3=0;
if (1<A && B<1000000)
{
for (A;A!=B;A++)
{
for (i=2;i!=A+1;i++)
{
if (A%i==0 && i&2!=0)
{
counter1+=1;
}
}
if (counter1==3)
{
for (i=2;i!=A+1;i++)
{
if (A%i==0 && i%2!=0)
{
chislo1=i;
break;
}
}
for (i=chislo1+1;i!=A+1;i++)
{
if (A%i==0 && i%2!=0)
{
chislo2=i;
break;
}
}
for (i=chislo2+1;i!=A+1;i++)
{
if (A%i==0 && i%2!=0)
{
chislo3=i;
cout<<A<<" "<<chislo1<<" "<<chislo2<<" "<<chislo3<<endl;
counter1=0;
counter1=0;
chislo1=0;
chislo2=0;
chislo3=0;
break;
}
}
}
}
}
else
{
cout<<"Неверный диапазон";
}
return 0;
}