What are the differences between these two codes ? AND Why ?
#include <iostream> using namespace std; int main(){ int prime=1; int num; int p_num=2; cin>>num; if (num==0){cout<< "no prime numbers";} else{for (; p_num<=num; p_num++){ prime=1; for (int i=2; i<p_num; i++){ if (p_num%i==0) prime=0;} if (prime==1) cout <<p_num <<endl;} } return 0; } AND #include <iostream> using namespace std; int main(){ int prime=1; int num; int p_num=2; cin>>num; if (num==0){cout<< "no prime numbers";} else{for (; p_num<=num; p_num++){ prime=1; for (int i=2; i<p_num; i++){ if (p_num%i==0) prime=0;} if (prime=1) cout <<p_num <<endl;} } return 0; } Thnx for answering this untidy question.