Friday, November 27, 2020

Find prime number from 0 to 100

 #include<iostream>

#include<cmath>
using namespace std;
int main()
{

    for(int i=2;i<100;i++)
    {
        int s=1;
       for(int j=2;j<sqrt(i);j++)
       {
           if(i%j==0)
           {
               s=0;
              break;
           }
         }
    if(s==1)
    cout<<" "<<i;
    }
cout<<endl<<"This is Eaglesoft Programmer";
return 0;
}

No comments:

Post a Comment