Deret Bilangan Prima




#include

void main()
{
int bil;
int i,j,counter;

printf("Masukkan batas atas deret : ");
scanf("%d",&bil);

printf("\n");
for(i=1;i<=bil;i++)
{
counter=0;
for(j=1;j<=i;j++)
{
if(i%j==0) counter++;
}
if(counter==2)
{
printf("%d  ",i);
}

}
printf("\n\n");
}

0 comments:

Post a Comment