السلام عليكم ممكن تشرحون لي ايش بيعمل check وليش كتبنا for loop مرتين
#include <iostream>
#include <conio.h>
using namespace std;
void main()
{
int no,counter,counter1,check;
cout<<"<-----------------------PRIME NO. SERIES------------------------>";
cout<<"\n\n\n\t\t\t INPUT THE VALUE OF N: ";
cin>>no;
cout<<"\n\n THE PRIME NO. SERIES B/W 1 TO: \n\n"<<no;
for(counter = 1; counter <= no; counter++)
{
check = 0;
//THIS LOOP WILL CHECK A NO TO BE PRIME NO. OR NOT.
for(counter1 = counter-1; counter1 > 1 ; counter1--)
if(counter%counter1 == 0){
check++; // INCREMENT CHECK IF NO. IS NOT A PRIME NO.
break;
}
if(check == 0)
cout<<" \t"<<counter;
} getch();
}
