#include <iostream.h>
#include <conio.h>
void main(){
int flag, r;
clrscr();
cout<< "\n The Prime numbers ending with digit 1 :";
for(int i = 500 ; i >=2 ; i--)
{
flag = 0;
for(int j = 2 ; j <= i-1 ; j++)
{
r = i%j;
if(r == 0)
{
flag = 1;
break;
}
}
if(flag == 0)
{
if(i%10 == 1)
cout<< i << " ";
}
}
getch();
}
No comments:
Post a Comment