# include
# include
using namespace std;
Int num, a, b, c, s, m, I, k, p [1001], m1, m2, n, t, j, group [20].
Void init ();
Void calculate ();
Void the output ();
Void get_pri_fac (int);
Void fun1 ();
Void fun2 ();
Void fun3 ();
Void fun4 ();
Void fun5 ();
Void init () {
For (int I=1; i<=m2; I++) {
P [I]=1;
}
}
Void calculate () {
For (int I=1; i <=m2; I++) {
If (I==1) {//
P [I]=0;
continue;
}
If (p [I]==1) {
For (int j=I + I; J & lt;=m2; J +=I) {//the number of the number of integer number (not including itself) to delete, corresponding to the array position both for 0.
P [j]=0;
}
}
}
}
Void the output () {
For (int I=m1; i <=m2; I++) {
If (p [I]==1) {
Cout & lt; }
}
}
Void get_pri_fac (int num)
{
int i;
For (I=2; i
While (num % I==0)
{
Printf (" % d ", I);
Num/=I;//should be updated after each into a prime factors did not decompose digital
}
}
printf("\n");
}
Int main () {
Int choice;
While (1)
{
Printf (" \ n \ n ");
Printf (" * * * * daffodil number or prime integer algorithm or the most times * * * * \ n ");
printf("\n");
Printf (" 1. The number of daffodils \ n ");
Printf (" 2. Judging prime \ n ");
Printf (" 3. To find all prime Numbers [m1, m2] interval \ n ");
Printf (" 4. All quality factors of solving integer \ n ");
Printf (" 5. Appear most times integer \ n ");
Printf (" 0. Quit \ n ");
printf("\n");
Printf (" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n ");
Printf (" do choose (0 to 5) : ");
The scanf (" % d ", & amp; Choice);
The switch (choice)
{
Case: 0 exit (0); break;
Case 1: fun1 (); break;
Case 2: fun2 (); break;
Case 3: fun3 (); break;
Case 4: fun4 (); break;
Case 5: fun5 ();
break;
}
Return (0);
}
}
Void fun1 ()
{
a=0;
B=0;
C=0;
The scanf (" % d ", & amp; num);
For (s=0; i
B=I % 100/10;
C=I/100;
S=a * a * b + a + b * b * c * c * c;
If (I - s==0)
Printf (" % d \ n ", s);
}
}
Void fun2 ()
{
Printf (" please enter an integer: ");
The scanf (" % d ", & amp; M);
K=(int) SQRT (m);
for(i=2; i<=k; I++)
If (m % I==0)
break;
If (i> K)
Printf (" % d is a prime \ n ", m);
The else
Printf (" % d is not a prime \ n, m);
}
Void fun3 ()
{
Cin & gt;> M1 & gt;> M2;
init();
Calculate ();
The output ();//in the end saved number is prime
}
Void fun4 ()
{
Int num, I;
While ((the scanf (" % d ", & amp; Num))!=(EOF)
{
Get_pri_fac (num);
}
}
Void fun5 ()
{
Int Max=0;
The scanf (" % d ", & amp; N);
for(i=0; i
}
for(i=0; i
for(j=0; J
c++;
}
}
If (c> Max) {
Max=c;
T=group [I];
}
}
Printf (" % d % d ", t, Max).
}
CodePudding user response:
What problemCodePudding user response:
what's the problem