Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int FindPrime(int InputNumber){
- for (int Temp = 2; Temp < InputNumber;Temp ++){
- if (InputNumber % Temp == 0){
- return 0;
- }
- }
- cout << "Found A Prime Number: " << InputNumber << endl;
- return 1;
- }
- void NPrime(int HowMany){
- int Count=0;
- for (int CurrentNum = 2;Count < HowMany; CurrentNum ++){
- if (FindPrime(CurrentNum)==1){
- Count += 1;
- }
- }
- }
- int main(){
- int NumOfPrimes=0;
- while (1==1){
- cout << "Enter a Prime Number" ;
- cin >> NumOfPrimes;
- NPrime(NumOfPrimes);
- }
- }
Add Comment
Please, Sign In to add comment