#include
Int isprime (int x)
{
Int flag, I;
If (x==1)
Flag=0;
The else
{
Flag=1;
for(i=2; i<=SQRT (x); I++)
{
If (x % I==0)
{
Flag=0;
break;
}
}
}
Return flag;
}
Int main (void)
{
Int m, n, s=0;
int i,j;
Int a, [80].
The scanf (" % d ", & amp; N);
While (n -) {
The scanf (" % d ", & amp; M);
for(j=1; j<=n; J++) {
for(i=1; i<=m; I++) {
If (isprime (I)==1) {
S=s + I;
}
}
A [j]==s;
S==0;
}
}
for(j=1; j<=n; J++) {
Printf (" % d \ n ", & amp; A [j]);
}
return 0;
}
CodePudding user response:
While (n -) {//n when read input gradually reduced to 0The scanf (" % d ", & amp; M);
for(j=1; j<=n; J++) {//this time n equals 0, direct cycle over
=========="to use a temporary variable to hold the for loop control
Int readn=n;
While (readn -) {//n when read input gradually reduced to 0
The scanf (" % d ", & amp; M);
for(j=1; j<=n; J++) {//this time n equals 0, direct cycle over
CodePudding user response:
Behind the printf is also the same, with n variables do control loopCodePudding user response:
Dual? (? ^ o ^)? , thank you thank youCodePudding user response:
Bosses, can I have a look at thisMatch * Amend (match * head)//input information game
{
system("cls");
Color system (" 72 ");
P1=head match * and * p2=head;
Char name1 [15], name2 [15].
Int goal1, goal2;
Printf (" input the home team: ");
The scanf (" % s ", name1);
Printf (" input the visitors: ");
The scanf (" % s ", name2);
Printf (" input the home team score: ");
The scanf (" % d ", & amp; Goal1);
Printf (" input the visiting team score: ");
The scanf (" % d ", & amp; Goal2);
While (p1!=NULL& & STRCMP (p2 - & gt; The name, name1)!=0)
{
P1=p1 - & gt; Next;
If (p1!=NULL)
{
P1 - & gt; Goal=p1 - & gt; Goal + goal1;
P1 - & gt; Lose=p1 - & gt; Lose + goal2;
If (goal1 & gt; Goal2) {
P1 - & gt; Num [1] + +;
}
Else if (goal1==goal2) {
P1 - & gt; Num [2] + +;
}
The else {
P1 - & gt; Num [3] + +;
}
P1 - & gt; Pure=p1 - & gt; Goal - p1 - & gt; Lose;
P1 - & gt; Integral=p1 - & gt; Num [1] * 3 + p1 - & gt; Num [2].
P1 - & gt; Num [0]=p1 - & gt; Num [1] + p1 - & gt; Num [2] + p1 - & gt; Num [3].
}
}
While (p2!=NULL& & STRCMP (p2 - & gt; The name, name2)!=0)
{
The p2=p2 - & gt; Next;
If (p2!=NULL)
{
The p2 - & gt; Goal=p2 - & gt; Goal + goal2;
The p2 - & gt; Lose=p2 - & gt; Lose + goal1;
If (goal2 & gt; Goal1) {
The p2 - & gt; Num [1] + +;
}
Else if (goal1==goal2) {
The p2 - & gt; Num [2] + +;
}
The else {
The p2 - & gt; Num [3] + +;
}
The p2 - & gt; Pure=p2 - & gt; Goal - the p2 - & gt; Lose;
The p2 - & gt; Integral=p2 - & gt; Num [1] * 3 + p2 - & gt; Num [2].
The p2 - & gt; Num [0]=p2 - & gt; Num [1] + p2 - & gt; Num [2] + p2 - & gt; Num [3].
}
}
return head;
}