First off, indent your code: it becomes a lot more readable:
#include <iostream>
using namespace std;
int main(){
int d,n,e;
cout<<"n="; cin>>n;
d=2;
while (d*d<=n){
e=0;
while (n%d==0){
n=n/d;
e++;
}
if(e>0,d++)
}
if (n>1) }
Now it is obvious that the code won't compile!
The format of an
if
statement is simple:
if (condition)
statement;
Or
if (condition) {
statement;
statement;
}
If the
condition
evaluates to true, the
statement
(or statements if a block is used) is executed. If it doesn't, they aren't.
Your code doesn't look like that:
if(e>0,d++)
if (n>1) }
So think about what exactly you are trying to do, and then think about the statement syntax.
You'll see what I mean.