The C++ Program to Find Prime Numbers between 1 to 100
Hello friends, below is the C++ Program by me to find the Prime Numbers between 1 to 100 using Sieve of Eratosthenes. The program would be common but please focus on the Logic. content C++ Program:- /* Following C++ program finds prime numbers from 1 to 100 using Method of Sieve of Eratosthenes You can modify the program according to your needs, but the general logic remains same. ->By Deep C. Patel */ #include<iostream> #include<conio.h> #define MAX 100 //you can increase the limit more than 100 to get more prime numbers using namespace std; int main() { int i=0, flag=0, num[MAX], primeNo[MAX], k=0, count=2; for(i=0;i<MAX;i++) { num[i]=i+1; } cout<<"\n\nThe Array has Elements as Shown Below:-\n"; for(i=0;i<MAX;i++) { cout<<"\n"<<num[i]; } primeNo[k]=2; //Declaring First Prime Number 2 k++; while(count<=100) { flag=0; ...