Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int max, i=2, count=0;
- cout << "Mennyi prímet keresünk?: "; cin >> max;
- do {
- int temp_var = 0;
- for(int k=i; k>1; --k)
- {
- if(i % k == 0) {
- temp_var++;
- }
- }
- if(temp_var == 1)
- {
- cout << " * A " << i << " prím ..." << endl;
- count++;
- }
- i++;
- } while(count != max);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement