12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
#include <iostream> using namespace std; int isPrime(int number); int main() { int i = 1, amountPrime = 0; bool result; while( i < 100) { result = isPrime(i); if(result == true) amountPrime++; else; i++; } cout << amountPrime << endl; system("PAUSE"); return 0; } //isPrime function int isPrime(int number) { int c; bool isPrime = true; c = number; for(int i = 2; i < c; i++) { if (c % i == 0) isPrime = false; break; } if(isPrime) return true; else return false; }
return isPrime