Void fun (int m, int * k, int xx [])
{
Int I, j, n=0;
For (I=4; i
for(j=2; jIf (I % j==0)
break;
If (jXx [n++]=I;
}
* k=n.
}
The main ()
{
Int m, n, zz [100].
Void NONO ();
Printf (" \ nPlease enter an integer number between 10 and 100: ");
The scanf (" % d ", & amp; N);
Fun (n, & amp; M, zz);
Printf (" \ n \ nThere are % d non - prime Numbers less than % d: ", m, n);
For (n=0; N & lt; m; N++)
Printf (" \ n % 4 d ", zz [n]);
NONO ();
}
Void NONO ()
{
/* please open the file within this function, enter test data, the fun function called,
Output data, and close the file, */
Int m, n, zz [100].
Rf FILE * and * wf;
Rf=fopen (" in dat ", "r");
Wf=fopen (" out. Dat ", "w");
The fscanf (rf, "% d", & amp; N);
Fun (n, & amp; M, zz);
Fprintf (wf, "\ n \ n % d % d", m, n);
For (n=0; N & lt; m; N++)
Fprintf (wf, "% d \ n", zz [n]);
The fclose (rf);
The fclose (wf);
}
CodePudding user response:
# include & lt; stdio.h>
Void fun (int m, int * k, int xx [])
{
Int I, j, n=0;
For (I=4; i{
for(j=2; jIf (I % j==0)
break;
//if (jIf (j & gt;=I)//it is prime
Xx [n++]=I;
}
* k=n.
}
Void NONO ();
Int main ()
{
Int m, n, zz [100].
Printf (" \ nPlease enter an integer number between 10 and 100: ");
The scanf (" % d ", & amp; N);
Fun (n, & amp; M, zz);
Printf (" \ n \ nThere are % d non - prime Numbers less than % d: ", m, n);
For (n=0; N & lt; m; N++)
Printf (" \ n % 4 d ", zz [n]);
NONO ();
}
Void NONO ()
{
/* please open the file within this function, enter test data, the fun function called,
Output data, and close the file, */
Int m, n, zz [100].
Rf FILE * and * wf;
Rf=fopen (" in dat ", "r");
if (! Rf)
return;
Wf=fopen (" out. Dat ", "w");
if (! Wf)
return;
The fscanf (rf, "% d", & amp; N);
Fun (n, & amp; M, zz);
Fprintf (wf, "\ n \ n % d % d", m, n);
For (n=0; N & lt; m; N++)
Fprintf (wf, "% d \ n", zz [n]);
The fclose (rf);
The fclose (wf);
}
For your reference ~
The original poster is fun for prime Numbers? Is not a prime number?
If a prime number, then you should judge if (j & gt;=I) should use the building started to write,
CodePudding user response:
A prime number,,,CodePudding user response:
Oh no, is a prime numberCodePudding user response:
The