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; }
1 Respuesta
+ 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 {} */