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
8.0k 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
8.2k points

Related questions

asked Apr 20, 2024 78.4k views
NiBE asked Apr 20, 2024
by NiBE
7.9k points
1 answer
3 votes
78.4k views
1 answer
2 votes
67.0k views