Home > Back-end >  I judge the prime program, there is no output, turn to what's the problem?
I judge the prime program, there is no output, turn to what's the problem?

Time:12-11

#include
#include
using namespace std;
Int main () {
int x;
The scanf (" % d \ n ", & amp; X);
int i;
Int isprime=1;
for(i=2; iIf I==0) (x % {
Isprime==0;
break;
}
}
If (isprime==1) {

Printf (" is the prime \ n "); }
The else {
Printf (" is not a prime \ n "); }
return 0;
}

CodePudding user response:

The
reference
the scanf (" % d \ n ", & amp; X);
this error, should be changed to:
 the scanf (" % d ", & amp; X); 

The
reference
isprime==0;
this is the assignment statement, is not a statement, should be changed to:
 isprime=0; 

CodePudding user response:

Thank you very much! Understand the assignment and outlining===, that the scanf (" % d \ n ", & amp; X) in the % d \ n will change to "% d \ n"?

CodePudding user response:

refer to the second floor cs666666666666 response:
thank you! Understand the assignment and outlining===, that the scanf (" % d \ n ", & amp; X) in the % d \ n will change to "% d \ n"?

When the input is more than a return type,
  • Related