176k views
0 votes
Write c++ program from 1to 100 to find prime numbers using statement.

please help me​

Write c++ program from 1to 100 to find prime numbers using statement. please help-example-1
User Somnium
by
5.1k points

1 Answer

5 votes

Answer:

int count;

for (int i = 1; i <= 100; i++){

count = 0;

for (int j = 1; j <=i; j++)

if (i%j==0) count ++;

if (count == 2) cout << i << " ";

}

User Simple
by
5.5k points