0

A program to print all prime numbers from 2 to 100.

The compiler runs the code but the output screen is not showing the prime numbers what's wrong with the code. Please help. #include<iostream> using namespace std; int main(){ int i,j; for(i=2;i<100;i++){ for(j=2;j<i;j++) if(i%j==0){ break; } } if(i==j){ cout<<i<<endl; } } return 0; }

18th Nov 2021, 4:57 AM
Harsh Debnath
1 Odpowiedź
+ 5
#include<iostream> using namespace std; int main(){ int i,j; for(i=2;i<100;i++){ for(j=2;j<i;j++){ if(i%j==0){ break; }} if(i==j){ cout<<i<<endl; }} return 0; } /* There was an error of mismatch curly brackets {} */
18th Nov 2021, 5:55 AM
HK Lite
HK Lite - avatar