Hi techies,
I am new into C++. I like to write a program that generates all the primes number between 1 and 100. Below is the code I have written but brings no output.
Thanks for any help…

//A program that generates all of the prime numbers between 1 and 100

#include <iostream>

using namespace std;

int main()
{
    int n;

    for(n=1; n>=100; n++)
    {
        bool isPrime = true;

        for(int i=2; i<n; i++)
        {
            if (n%i==0)
            {
                isPrime = false;
                break;
            }
        }
        if(isPrime)
        {
            cout<<n <<" is Prime";
        }
    }

    return 0;
}
  • No Related Post