I was given a problem to find out all the prime numbers within a range.Just after I wrote the program I found numerous other codes to solve the problem.I am interested to know is my algorithm efficient?is it like sieve filtration?(before writing this code I had no clear idea on sieve filtration method)or the algorithm I used is a crap.:P


    			void prime_gen(int a,int b)
				{
				
				
					int array[4]={2,3,5,7},holder[1000000]={0},count=0,flag=0,length=0,final_length=0;
					
					for(int i=0;i<b;i++)
					{
						for(int j=0;j<4;j++)
						{
							if(i==array[j])
							{
								break;
							}
							else 
							{
								if(i%array[j]==0)
								{
									count++;
									
								}
							}
						}
						if(count==0)
						{
							if(i>1)
							{
								holder[length++]=i;
								
							}
							else
							{
								length=0;
							}
						}
						count=0;
					}
					
					if(length==0)
					{	
						cout<<"No prime numbers exist within the range";
						cout<<"\n";
						
					}
					else 
					{
							cout<<"Prime numbers are:";
							for(int i=0;i<length;i++)
							{
								int t=holder[i];
								
								for(int check=0;check<length;check++)
								{
									
									if(t!=holder[check])
									{
										if(t%holder[check]==0)
										{
										 	  t=0;
										 	  final_length = length-1;
										}
										else
										{
				                              t=t;
										      final_length=length;
											
										}
										
									}
									
								}
								
								if(t!=0&&t>=a)cout<<t<<"\t";
							
							}
							
							cout<<"Total count:"<<final_length<<endl;
							
					}
				
					
				}
				
				int main()
				{
					
					int a,b;
					
					cout<<"Put the first integer:";
					cin>>a;
					
					cout<<"Put the second integer:";
					cin>>b;
					
					prime_gen(a,b);	
					
				}